private void WrappedJob_JobCompletedEvent(object sender, JobEventArgs e)
        {
            Job j = (Job)sender;

            lock (_refCountLock)
            {
                _refCount.RemoveItem(j.Name);
            }
        }
示例#2
0
        public JobWrapper Dequeue()
        {
            JobWrapper item = _queue.Dequeue();

            // When the job completes, remove it from the reference counter.
            item.WrappedJob.JobCompletedEvent += (sender, args) =>
            {
                lock (_refCountLock)
                {
                    _refCount.RemoveItem(item.WrappedJob.Name);
                }
            };

            return(item);
        }