Example #1
0
        void WaitCallback(object state)
        {
            var taskInThread = state as TaskInThread;

            Exception exception = null;

            try
            {
                taskInThread.Task.WaitCallback(taskInThread.Task.State);
            }
            catch (Exception e)
            {
                exception = e;
            }

            var result = new ResultInQueue
            {
                ResultCallback = taskInThread.Task.ResultCallback,
                State          = taskInThread.Task.State,
                Exception      = exception
            };

            // 処理結果をキューへ入れます。
            lock (resultQueue) resultQueue.Enqueue(result);

            // 空き Thread としてマークします。
            lock (freeThread) freeThread.Enqueue(taskInThread);
        }
        /// <summary>
        /// ThreadPool から提供される Thread から呼び出されます。
        /// </summary>
        /// <param name="state">Task。</param>
        void WaitCallback(object state)
        {
            var taskInThread = state as TaskInThread;

            InterBlockMesh interBlockMesh = null;
            Exception      exception      = null;

            try
            {
                interBlockMesh = taskInThread.Task.Execute();
            }
            catch (Exception e)
            {
                exception = e;
            }

            var result = new ResultInQueue
            {
                ResultCallback = taskInThread.Task.Callback,
                Name           = taskInThread.Task.Name,
                InterBlockMesh = interBlockMesh,
                Exception      = exception
            };

            // 処理結果をキューへ入れます。
            lock (resultQueue) resultQueue.Enqueue(result);

            // 空き Thread としてマークします。
            lock (freeThread) freeThread.Enqueue(taskInThread);
        }
Example #3
0
        void WaitCallback(object state)
        {
            var taskInThread = state as TaskInThread;

            Exception exception = null;
            try
            {
                taskInThread.Task.WaitCallback(taskInThread.Task.State);
            }
            catch (Exception e)
            {
                exception = e;
            }

            var result = new ResultInQueue
            {
                ResultCallback = taskInThread.Task.ResultCallback,
                State = taskInThread.Task.State,
                Exception = exception
            };

            // 処理結果をキューへ入れます。
            lock (resultQueue) resultQueue.Enqueue(result);

            // 空き Thread としてマークします。
            lock (freeThread) freeThread.Enqueue(taskInThread);
        }
        /// <summary>
        /// ThreadPool から提供される Thread から呼び出されます。
        /// </summary>
        /// <param name="state">Task。</param>
        void WaitCallback(object state)
        {
            var taskInThread = state as TaskInThread;

            InterBlockMesh interBlockMesh = null;
            Exception exception = null;
            try
            {
                interBlockMesh = taskInThread.Task.Execute();
            }
            catch (Exception e)
            {
                exception = e;
            }

            var result = new ResultInQueue
            {
                ResultCallback = taskInThread.Task.Callback,
                Name = taskInThread.Task.Name,
                InterBlockMesh = interBlockMesh,
                Exception = exception
            };

            // 処理結果をキューへ入れます。
            lock (resultQueue) resultQueue.Enqueue(result);

            // 空き Thread としてマークします。
            lock (freeThread) freeThread.Enqueue(taskInThread);
        }