Пример #1
0
        public void Dispose()
        {
            if (!isDisposed)
            {
                isDisposed = true;

                _cancelRegisters.ForEach(r => r.Dispose());
                _cancelRegisters.Clear();

                _cancelTokenSource.Dispose();
                _cancelTokenSource = null;

                _task       = null;
                _taskThread = null;
            }
        }
Пример #2
0
        internal TaskExecutionInfo(IThreadTaskInfo task, CancellationTokenSource cancelTokenSource, LockInfo lockInfo, SingleTaskDefinition taskDefinition)
        {
            if (lockInfo == null)
            {
                throw new ArgumentNullException("lockInfo is null.");
            }
            if (taskDefinition == null)
            {
                throw new ArgumentNullException("taskDefinition is null.");
            }
            if (cancelTokenSource == null)
            {
                throw new ArgumentNullException("cancelTokenSource is null.");
            }

            //Task may be null when first initialized.
            _task              = task;
            _lockInfo          = lockInfo;
            _taskDefinition    = taskDefinition;
            _cancelTokenSource = cancelTokenSource;
            _lastAliveSignalAt = null;
        }
Пример #3
0
 internal void SetTask(IThreadTaskInfo task)
 {
     _task = task;
 }