MDN’s new design is in Beta! A sneak peek:


mozilla::MonitorAutoEnter is an RAII helper for mozilla::Monitor. It is designed to make using mozilla::Monitor safer and easier. To use mozilla::MonitorAutoEnter, declare and initialize it with a reference to a mozilla::Monitor. The mozilla::MonitorAutoEnter constructor will Enter() the underlying mozilla::Monitor automatically. When the mozilla::MonitorAutoEnter goes out of scope, its destructor will Exit() the underlying mozilla::MonitorAutoEnter.

Important: When a mozilla::MonitorAutoEnter is live on the stack, your code is guaranteed to own the underlying mozilla::Monitor.


    in mozilla::Monitor& monitor;

This parameter is a reference so as to guarantee that your code has already properly constructed the mozilla::Monitor.



nsresult Wait(
    in PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT

Wait on the underlying monitor until it is Notifyed.


nsresult Notify(void);

Notify one thread waiting on the underlying monitor.


nsresult NotifyAll(void);

Notify all threads waiting on the underlying monitor.

See also






Document Tags and Contributors

 Contributors to this page: Sheppy, teoli, cgj
 Last updated by: Sheppy,