[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern void pool_queue (AsyncResult ares);
+ // TODO: It should be interface interface only to avoid extra allocation
+ internal static void QueueWorkItem (WaitCallback callBack, object state)
+ {
+ pool_queue (new AsyncResult (callBack, state, false));
+ }
+
public static RegisteredWaitHandle RegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack,
object state,
list.RemoveAt (i);
count--;
i--;
- ThreadPool.UnsafeQueueUserWorkItem (TimerCB, timer);
+ ThreadPool.QueueWorkItem (TimerCB, timer);
long period = timer.period_ms;
long due_time = timer.due_time_ms;
bool no_more = (period == -1 || ((period == 0 || period == Timeout.Infinite) && due_time != Timeout.Infinite));