/// <summary> /// Called by the thread pool to actually run the work item. /// </summary> /// <param name="arg">The work item to run.</param> private static void runTask(object arg) { DispatchTaskDelegate del = (DispatchTaskDelegate)arg; del(); }
/// <summary> /// Dispatches a work item to the thread pool. /// </summary> /// <param name="del">The work item to dispatch.</param> public static void Run(DispatchTaskDelegate del) { ThreadPool.QueueUserWorkItem(new WaitCallback(runTask), del); }