public DataBaseContext(CremaHost cremaHost) { this.CremaHost = cremaHost; this.Dispatcher = new CremaDispatcher(this); this.taskEvent = new TaskResetEvent <Guid>(this.Dispatcher); this.callbackEvent = new IndexedDispatcher(this); }
void IHashWorkManager.QueueTask(SimpleDelegate task) { // Enqueue item in list TaskResetEvent item = new TaskResetEvent(task, new ManualResetEvent(false)); lock (TaskQueueLock) { item.BeginUse(); TaskQueueItems.Add(item); } // Enqueu item in thread pool ThreadPool.QueueUserWorkItem((object threadContext) => { // Task will be performed item.Task(); // Wait handle will be reset lock (TaskQueueLock) { item.WaitHandle.Set(); item.EndUse(); // If item is no longer in use, item will be removed from list and disposed if (!item.InUse) { TaskQueueItems.Remove(item); item.WaitHandle.Close(); } } }); }
public DomainContext(CremaHost cremaHost) { this.CremaHost = cremaHost; this.Dispatcher = new CremaDispatcher(this); this.creationEvent = new TaskResetEvent <Guid>(this.Dispatcher); this.deletionEvent = new TaskResetEvent <Guid>(this.Dispatcher); this.callbackEvent = new IndexedDispatcher(this); }