예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        /// <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);
        }