예제 #1
0
        /// <summary>
        /// Cancel all work items using thread abortion
        /// </summary>
        /// <param name="abortExecution">True to stop work items by raising ThreadAbortException</param>
        /// <returns><c>true</c> if this instance cancel abortExecution; otherwise, <c>false</c>.</returns>
        public override void Cancel(bool abortExecution)
        {
            lock (_lock)
            {
                _canceledWorkItemsGroup.IsCanceled = true;
                _workItemsQueue.Clear();
                _workItemsInStpQueue    = 0;
                _canceledWorkItemsGroup = new CanceledWorkItemsGroup();
            }

            if (abortExecution)
            {
                _stp.CancelAbortWorkItemsGroup(this);
            }
        }
		/// <summary>
		/// Cancel all work items using thread abortion
		/// </summary>
		/// <param name="abortExecution">True to stop work items by raising ThreadAbortException</param>
		/// <returns><c>true</c> if this instance cancel abortExecution; otherwise, <c>false</c>.</returns>
	    public override void Cancel(bool abortExecution)
	    {
	        lock (_lock)
	        {
	            _canceledWorkItemsGroup.IsCanceled = true;
	            _workItemsQueue.Clear();
	            _workItemsInStpQueue = 0;
	            _canceledWorkItemsGroup = new CanceledWorkItemsGroup();
	        }

	        if (abortExecution)
	        {
	            _stp.CancelAbortWorkItemsGroup(this);
	        }
	    }