STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::onoff_switch Class Reference

Detailed Description

Definition at line 29 of file onoff_switch.h.

+ Inheritance diagram for stxxl::onoff_switch:
+ Collaboration diagram for stxxl::onoff_switch:

Public Member Functions

 onoff_switch (bool flag=false)
 construct switch More...
 
bool is_on ()
 return true if switch is ON More...
 
void off ()
 turn switch OFF and notify one waiter More...
 
void on ()
 turn switch ON and notify one waiter More...
 
void wait_for_off ()
 wait for switch to turn OFF More...
 
void wait_for_on ()
 wait for switch to turn ON More...
 

Private Attributes

condition_variable m_cond
 condition variable More...
 
mutex m_mutex
 mutex for condition variable More...
 
bool m_on
 the switch's state More...
 

Additional Inherited Members

- Private Member Functions inherited from stxxl::noncopyable
 noncopyable ()
 

Constructor & Destructor Documentation

stxxl::onoff_switch::onoff_switch ( bool  flag = false)
inline

construct switch

Definition at line 42 of file onoff_switch.h.

Member Function Documentation

bool stxxl::onoff_switch::is_on ( )
inline

return true if switch is ON

Definition at line 76 of file onoff_switch.h.

void stxxl::onoff_switch::off ( )
inline

turn switch OFF and notify one waiter

Definition at line 54 of file onoff_switch.h.

References stxxl::scoped_mutex_lock::unlock().

void stxxl::onoff_switch::on ( )
inline

turn switch ON and notify one waiter

Definition at line 46 of file onoff_switch.h.

References stxxl::scoped_mutex_lock::unlock().

void stxxl::onoff_switch::wait_for_off ( )
inline

wait for switch to turn OFF

Definition at line 69 of file onoff_switch.h.

void stxxl::onoff_switch::wait_for_on ( )
inline

wait for switch to turn ON

Definition at line 62 of file onoff_switch.h.

Referenced by stxxl::wait_any().

Member Data Documentation

condition_variable stxxl::onoff_switch::m_cond
private

condition variable

Definition at line 35 of file onoff_switch.h.

mutex stxxl::onoff_switch::m_mutex
private

mutex for condition variable

Definition at line 32 of file onoff_switch.h.

bool stxxl::onoff_switch::m_on
private

the switch's state

Definition at line 38 of file onoff_switch.h.


The documentation for this class was generated from the following file: