private static void WaitCallback_Context(object state) { QueueUserWorkItemCallback queueUserWorkItemCallback = (QueueUserWorkItemCallback)state; WaitCallback waitCallback = queueUserWorkItemCallback.callback; waitCallback(queueUserWorkItemCallback.state); }
private static bool QueueUserWorkItemHelper(WaitCallback callBack, object state, ref StackCrawlMark stackMark, bool compressStack) { bool flag = true; if (callBack == null) { throw new ArgumentNullException("WaitCallback"); } EnsureVMInitialized(); if (ThreadPoolGlobals.useNewWorkerPool) { try { return(flag); } finally { QueueUserWorkItemCallback callback = new QueueUserWorkItemCallback(callBack, state, compressStack, ref stackMark); ThreadPoolGlobals.workQueue.Enqueue(callback, true); flag = true; } } _ThreadPoolWaitCallback tpcallBack = new _ThreadPoolWaitCallback(callBack, state, compressStack, ref stackMark); int num = ThreadPoolGlobals.tpQueue.EnQueue(tpcallBack); if (ThreadPoolGlobals.tpHosted || (num < ThreadPoolGlobals.tpWarmupCount)) { return(AdjustThreadsInPool((uint)ThreadPoolGlobals.tpQueue.GetQueueCount())); } UpdateNativeTpCount((uint)ThreadPoolGlobals.tpQueue.GetQueueCount()); return(flag); }
private static void WaitCallback_Context(Object state) { QueueUserWorkItemCallback obj = (QueueUserWorkItemCallback)state; WaitCallback wc = obj.callback; Debug.Assert(null != wc); wc(obj.state); }
public static void UnsafeQueueUserWorkItem( WaitCallback callBack, // NOTE: we do not expose options that allow the callback to be queued as an APC Object state ) { Debug.Assert(callBack != null); QueueUserWorkItemCallback tpcallBack = new QueueUserWorkItemCallback(callBack, state, null); ThreadPoolGlobals.workQueue.Enqueue(tpcallBack, true); }
public static bool UnsafeQueueUserWorkItem(WaitCallback callBack, Object state) { if (callBack == null) { throw new ArgumentNullException(nameof(callBack)); } IThreadPoolWorkItem tpcallBack = new QueueUserWorkItemCallback(callBack, state, null); ThreadPoolGlobals.workQueue.Enqueue(tpcallBack, forceGlobal: true); return(true); }
private static bool QueueUserWorkItemHelper(WaitCallback callBack, object state, ref StackCrawlMark stackMark, bool compressStack) { bool flag = true; if (callBack == null) { throw new ArgumentNullException("WaitCallback"); } ThreadPool.EnsureVMInitialized(); try { } finally { QueueUserWorkItemCallback workItemCallback = new QueueUserWorkItemCallback(callBack, state, compressStack, ref stackMark); ThreadPoolGlobals.workQueue.Enqueue((IThreadPoolWorkItem)workItemCallback, true); flag = true; } return(flag); }
internal static void WaitCallback_Context(object state) { QueueUserWorkItemCallback callback = (QueueUserWorkItemCallback)state; callback.callback(callback.state); }
private static bool QueueUserWorkItemHelper(WaitCallback callBack, object state, ref StackCrawlMark stackMark, bool compressStack) { bool flag = true; if (callBack == null) { throw new ArgumentNullException("WaitCallback"); } EnsureVMInitialized(); if (ThreadPoolGlobals.useNewWorkerPool) { try { return flag; } finally { QueueUserWorkItemCallback callback = new QueueUserWorkItemCallback(callBack, state, compressStack, ref stackMark); ThreadPoolGlobals.workQueue.Enqueue(callback, true); flag = true; } } _ThreadPoolWaitCallback tpcallBack = new _ThreadPoolWaitCallback(callBack, state, compressStack, ref stackMark); int num = ThreadPoolGlobals.tpQueue.EnQueue(tpcallBack); if (ThreadPoolGlobals.tpHosted || (num < ThreadPoolGlobals.tpWarmupCount)) { return AdjustThreadsInPool((uint) ThreadPoolGlobals.tpQueue.GetQueueCount()); } UpdateNativeTpCount((uint) ThreadPoolGlobals.tpQueue.GetQueueCount()); return flag; }