示例#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);
        }
        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);
        }
示例#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();
 }