Esempio n. 1
0
        public EmptyFuture Enqueue(Action work)
        {
            var future = new EmptyFuture();

            DoWork(work, future);
            return(future);
        }
Esempio n. 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);
        }
Esempio n. 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);
     }
 }
Esempio n. 6
0
 private static void DoWork(Action work, EmptyFuture future)
 {
     try {
         work();
         future.Set();
     } catch (Exception e) {
         future.Failed(e);
     }
 }
Esempio n. 7
0
 public void DoSetup()
 {
     mFuture = new EmptyFuture();
 }