Beispiel #1
0
 public static bool QueueUserWorkItem <TState>(System.Action <TState> callBack,
                                               TState state, bool preferLocal)
 {
     java.lang.Runnable.Delegate runnable = () => callBack(state);
     JavaThreadPool.execute(runnable.AsInterface());
     return(true);
 }
Beispiel #2
0
 public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack,
                                      object state)
 {
     if (callBack == null)
     {
         throw new System.ArgumentNullException();
     }
     java.lang.Runnable.Delegate runnable = () => callBack(state);
     JavaThreadPool.execute(runnable.AsInterface());
     return(true);
 }
Beispiel #3
0
 public static void UnsafeQueueCustomWorkItem(IThreadPoolWorkItem workItem, bool forceGlobal)
 {
     java.lang.Runnable.Delegate runnable = () => workItem.ExecuteWorkItem();
     JavaThreadPool.execute(runnable.AsInterface());
 }
Beispiel #4
0
 // helper method for Timer::run, because TimerCallback is not castable to WaitCallback
 public static void QueueTimerWorkItem(TimerCallback func, object data)
 {
     JavaThreadPool.execute(((java.lang.Runnable.Delegate)(() => func(data))).AsInterface());
 }