예제 #1
0
        public EmptyFuture Enqueue(Action work)
        {
            var future = new EmptyFuture();

            DoWork(work, future);
            return(future);
        }
예제 #2
0
        public EmptyFuture Enqueue <T>(T data, Action <T> work)
        {
            var future = new EmptyFuture();

            DoWork(data, work, future);
            return(future);
        }
예제 #3
0
        public EmptyFuture Enqueue(Action work)
        {
            var future = new EmptyFuture();

            ThreadPool.QueueUserWorkItem(o => DoWork(work, future));
            return(future);
        }
예제 #4
0
        public EmptyFuture Enqueue <T>(T data, Action <T> work)
        {
            var future = new EmptyFuture();

            ThreadPool.QueueUserWorkItem(o => DoWork((T)o, work, future), data);
            return(future);
        }
예제 #5
0
 private static void DoWork <T>(T data, Action <T> work, EmptyFuture future)
 {
     try {
         work(data);
         future.Set();
     } catch (Exception e) {
         future.Failed(e);
     }
 }
예제 #6
0
 private static void DoWork(Action work, EmptyFuture future)
 {
     try {
         work();
         future.Set();
     } catch (Exception e) {
         future.Failed(e);
     }
 }
예제 #7
0
 public void DoSetup()
 {
     mFuture = new EmptyFuture();
 }