public static bool QueueExtTask(string taskName, WaitCallback callback, object state, WaitCallback callbackStart, WaitCallback callbackEnd, WaitCallback callbackException) { ExtTaskInfo ti = new ExtTaskInfo(taskName, state, callback, callbackStart, callbackEnd, callbackException); Trace("QueueExtTask : " + taskName); return(ThreadPool.QueueUserWorkItem(new WaitCallback(ExtTaskProc), ti)); }
static void ExtTaskProc(Object stateInfo) { ExtTaskInfo ti = (ExtTaskInfo)stateInfo; Trace("ExtTaskStarted : " + ti.Name); try { ti.DoStartCallback(); } catch (Exception E) { FreeCL.RTL.Trace.TraceException(E); ti.DoExceptionCallback(E); } try { ti.DoCallback(); } catch (Exception E) { FreeCL.RTL.Trace.TraceException(E); ti.DoExceptionCallback(E); } finally { try { ti.DoEndCallback(); } catch (Exception E) { FreeCL.RTL.Trace.TraceException(E); ti.DoExceptionCallback(E); } } Trace("TaskStopped : " + ti.Name); }
public static bool QueueExtTask(string taskName, WaitCallback callback, object state, WaitCallback callbackStart, WaitCallback callbackEnd, WaitCallback callbackException) { ExtTaskInfo ti = new ExtTaskInfo(taskName, state, callback, callbackStart, callbackEnd, callbackException); Trace("QueueExtTask : " + taskName); return ThreadPool.QueueUserWorkItem(new WaitCallback(ExtTaskProc), ti); }