public async Task <bool> RemoveJobAsync(string name) { var eventArgs = new RemoveJobEventArgs(name); JobRemoved?.Invoke(this, eventArgs); return(await(eventArgs.Success ?? Task.FromResult(false)).ConfigureAwait(false)); }
public void remove(string key) //Se non riesce a poppae nulla restituisce void e mette a dormire il consumer { Job j = null; list.TryRemove(key, out j); if (j != null) { JobRemoved?.Invoke(j); } }
void OnJobFinished(object o, EventArgs args) { var job = o as Job; lock (jobs) { jobs.Remove(job); } JobRemoved?.Invoke(job); Schedule(); }