public Option <WorkDispatch <W> > Dispatch() { var work = default(WorkSubmission <W>); if (enqueued.TryDequeue(out work)) { var item = new WorkDispatch <W>(work); if (dispatched.TryAdd(item.WorkId, item)) { return(item); } } return(none <WorkDispatch <W> >()); }
public WorkCompletion(WorkDispatch <W> work, TResult result) { this.work = work; this.result = result; this.timestamp = now(); }