// Queue a new I/O completion item within the thread pool. // This version is used by the "System" assembly in ECMA_COMPAT // mode when "WaitCallback" is not defined. internal static bool QueueCompletionItem (AsyncCallback callBack, IAsyncResult state) { lock (typeof(ThreadPool)) { if (completionWait == null) { completionWait = new Object(); } } AddCompletionItem (new WorkItem(ClrSecurity.GetPermissionsFrom(1), callBack, state)); return(true); }
// Register a callback to be invoked when a wait handle is available. public static RegisteredWaitHandle RegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, Object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) { if (waitObject == null) { throw new ArgumentNullException("waitObject"); } if (millisecondsTimeOutInterval < -1) { throw new ArgumentOutOfRangeException ("millisecondsTimeOutInterval", _("ArgRange_NonNegOrNegOne")); } WorkItem item = new WorkItem(ClrSecurity.GetPermissionsFrom(1), waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce); AddWorkItem(item); return(new RegisteredWaitHandle(item)); }
// Queue a new work item within the thread pool. public static bool QueueUserWorkItem(WaitCallback callBack, Object state) { AddWorkItem(new WorkItem(ClrSecurity.GetPermissionsFrom(1), callBack, state)); return(true); }