/// <summary>Returns an already completed, new mutex instance</summary> private static AsyncCancelableMutex CreateAlreadyDone() { var mtx = new AsyncCancelableMutex(CancellationToken.None); mtx.Set(async: false); return(mtx); }
/// <summary>Wake up the producer if it is blocked</summary> protected void WakeUpBlockedProducer_NeedsLocking() { if (m_producerLock.Set(async: true)) { LogConsumer("Woke up blocked producer"); } }
private void NotifyConsumerOfTaskCompletion_NeedsLocking() { Contract.Requires(m_mode == AsyncOrderingMode.CompletionOrder); if (!m_receivedLast && m_completionLock.Set(async: true)) { LogProducer("Woke up blocked consumer because one task completed"); } }