private void TakeTask() { lock (this.SyncObject1) { if (this.Value != "put") { Monitor.Wait(this.SyncObject1); } this.Value = "taken"; } }
/// <summary> /// Releases the writer, another writer my continue or all the readers may start reading /// </summary> public void ReleaseWriter() { writePermission.Release(); // >> REMOVES WRITER FROM WRITE QUEUE lock (lockObject) { if (readersWaiting > 0) { Monitor.Wait(lockObject); } } writerTS.Release(); }
public static bool Wait(object obj, int timeout) { return(SMonitor.Wait(obj, timeout)); }
public static void Wait(object obj) { SMonitor.Wait(obj); }