示例#1
0
 public TaskHandle(ClientHandle clientHandle, UserTask task, object userState, Action <TaskStatus> callback)
 {
     ClientHandle = clientHandle;
     Task         = task;
     UserState    = userState;
     Callback     = callback;
 }
示例#2
0
        public static ClientHandle QueueUserTask(UserTask task, object userState, Action <TaskStatus> callback)
        {
            InitializeThreadPool();

            ClientHandle clientHandle = new ClientHandle(Guid.NewGuid());
            TaskHandle   taskHandle   = new TaskHandle(clientHandle, task, userState, callback);

            lock (_queueLock)
            {
                _readyQueue.Enqueue(taskHandle);
            }

            return(clientHandle);
        }