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
.Constructors
MonitorAutoEnter( in mozilla::Monitor& monitor; );
This parameter is a reference so as to guarantee that your code has already properly constructed the mozilla::Monitor
.
Methods
Wait()
nsresult Wait( in PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT );
Wait on the underlying monitor until it is Notify
ed.
Notify()
nsresult Notify(void);
Notify one thread waiting on the underlying monitor.
NotifyAll()
nsresult NotifyAll(void);
Notify all threads waiting on the underlying monitor.
See also