• Skip to main content
  • Select language
  • Skip to search
MDN Web Docs
  • Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs / DOM
    • WebExtensions
    • MathML
  • References & Guides
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
  1. MDN
  2. Mozilla
  3. Namespace
  4. Mozilla
  5. mozilla::CondVar

mozilla::CondVar

In This Article
  1. Methods
    1. Constructor
    2. Wait()
    3. Notify()
    4. NotifyAll()
    5. AssertCurrentThreadOwnsMutex()
    6. AssertNotCurrentThreadOwnsMutex()
  2. See also

mozilla::CondVar is a bare wrapper around PRCondVar. Please see Introduction_to_NSPR for a high-level summary of its semantics.

#include "CondVar.h"

Methods

Constructor

CondVar(Mutex& aMutex, const char* aName)

Initialize the CondVar with its associated mutex and a name to reference it by.

Wait()

 

nsresult Wait(
    in PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT
);

Wait on this CondVar until it is Notifyed.

 

Notify()

 

nsresult Notify(void);

Notify one thread waiting on this CondVar.

 

NotifyAll()

 

nsresult NotifyAll(void);

Notify all threads waiting on this CondVar.

 

AssertCurrentThreadOwnsMutex()

Assert that the current thread has successfully Locked the mutex undergirding this CondVar. Does not incur a runtime penalty in optimized builds.

AssertNotCurrentThreadOwnsMutex()

Assert that the current thread has not successfully Locked the mutex undergirding this CondVar. Does not incur a runtime penalty in optimized builds.

See also

  • PRCondVar

Document Tags and Contributors

Tags: 
  • mozilla::
  • Thread_Synchronization
  • XPCOM
  • XPCOM API Reference
 Contributors to this page: Sheppy, teoli, Ted_Mielczarek, cgj
 Last updated by: Sheppy, May 11, 2017, 5:40:23 AM