private void RunJob(ServiceJob job) { lock (_jobsInWork) { if (_jobsInWork.ContainsKey(job)) { return; } _jobsInWork.Add(job, Task.Factory.StartNew(OnJobExecute, job)); } }
/// <summary> /// Add service job to jobs list for an execution /// </summary> /// <param name="job">Service job</param> protected void AddJob(ServiceJob job) { _jobsList.Add(job); }
/// <summary> /// Signal service what job has been completed /// </summary> /// <param name="job">Your ServiceJob instance</param> public void SetJobFinished(ServiceJob job) { _jobsInWork.Remove(job); }
private void RunJob(ServiceJob job) { lock (_jobsInWork) { if (_jobsInWork.ContainsKey(job)) return; _jobsInWork.Add(job, Task.Factory.StartNew(OnJobExecute, job)); } }