public EmptyFuture Enqueue(Action work) { var future = new EmptyFuture(); DoWork(work, future); return(future); }
public EmptyFuture Enqueue <T>(T data, Action <T> work) { var future = new EmptyFuture(); DoWork(data, work, future); return(future); }
public EmptyFuture Enqueue(Action work) { var future = new EmptyFuture(); ThreadPool.QueueUserWorkItem(o => DoWork(work, future)); return(future); }
public EmptyFuture Enqueue <T>(T data, Action <T> work) { var future = new EmptyFuture(); ThreadPool.QueueUserWorkItem(o => DoWork((T)o, work, future), data); return(future); }
private static void DoWork <T>(T data, Action <T> work, EmptyFuture future) { try { work(data); future.Set(); } catch (Exception e) { future.Failed(e); } }
private static void DoWork(Action work, EmptyFuture future) { try { work(); future.Set(); } catch (Exception e) { future.Failed(e); } }
public void DoSetup() { mFuture = new EmptyFuture(); }