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

            DoWork(work, future);
            return(future);
        }
Exemplo n.º 2
0
        public EmptyFuture Enqueue <T>(T data, Action <T> work)
        {
            var future = new EmptyFuture();

            DoWork(data, work, future);
            return(future);
        }
Exemplo n.º 3
0
        public EmptyFuture Enqueue(Action work)
        {
            var future = new EmptyFuture();

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