/// <summary> /// Submits the specified runnable to the thread pool. /// </summary> /// <param name="runnable">The runnable.</param> /// <returns></returns> public Future <Object> Submit(Action runnable) { var future = new SimpleFutureImpl <Object>(); _taskQueue.Push(runnable.Invoke); return(future); }
/// <summary> /// Submits the specified callable to the thread pool. /// </summary> /// <param name="callable">The callable.</param> /// <returns></returns> public Future <T> Submit <T>(ICallable <T> callable) { var future = new SimpleFutureImpl <T>(); _taskQueue.Push( () => future.Value = callable.Call()); return(future); }
/// <summary> /// Submits the specified runnable to the thread pool. /// </summary> /// <param name="runnable">The runnable.</param> /// <returns></returns> public Future <Object> Submit(Action runnable) { var future = new SimpleFutureImpl <Object>(); Log.Debug("Submit: Instance {0} - enqueuing action", _id); _taskQueue.Push(runnable.Invoke); return(future); }
/// <summary> /// Submits the specified callable to the thread pool. /// </summary> /// <param name="callable">The callable.</param> /// <returns></returns> public Future <T> Submit <T>(ICallable <T> callable) { var future = new SimpleFutureImpl <T>(); Log.Debug("Submit: Instance {0} - enqueuing callable", _id); _taskQueue.Push( () => future.Value = callable.Call()); return(future); }
/// <summary> /// Submits the specified callable to the thread pool. /// </summary> /// <param name="callable">The callable.</param> /// <returns></returns> public Future <T> Submit <T>(Func <T> callable) { var future = new SimpleFutureImpl <T>(); _taskQueue.Push( delegate { future.Value = callable.Invoke(); }); return(future); }
/// <summary> /// Submits the specified callable to the thread pool. /// </summary> /// <param name="callable">The callable.</param> /// <returns></returns> public Future <T> Submit <T>(Func <T> callable) { var future = new SimpleFutureImpl <T>(); Log.Debug("Submit: Instance {0} - enqueuing function", _id); _taskQueue.Push( delegate { future.Value = callable.Invoke(); }); return(future); }