Beispiel #1
0
 /// <summary>
 /// Constructs a new accelerator.
 /// </summary>
 /// <param name="context">The target context.</param>
 /// <param name="type">The target accelerator type.</param>
 internal Accelerator(Context context, AcceleratorType type)
 {
     Context         = context ?? throw new ArgumentNullException(nameof(context));
     AcceleratorType = type;
     InitGC();
     memoryCache = new MemoryBufferCache(this);
 }
Beispiel #2
0
        /// <summary>
        /// Constructs a new accelerator.
        /// </summary>
        /// <param name="context">The target context.</param>
        /// <param name="type">The target accelerator type.</param>
        internal Accelerator(Context context, AcceleratorType type)
        {
            Context         = context ?? throw new ArgumentNullException(nameof(context));
            AcceleratorType = type;

            AutomaticBufferDisposalEnabled = !context.HasFlags(
                ContextFlags.DisableAutomaticBufferDisposal);
            AutomaticKernelDisposalEnabled = !context.HasFlags(
                ContextFlags.DisableAutomaticKernelDisposal);
            InitKernelCache();
            InitGC();

            memoryCache = new MemoryBufferCache(this);
        }