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

Detailed Description

Definition at line 28 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 41 of file onoff_switch.h.

Member Function Documentation

bool stxxl::onoff_switch::is_on ( )
inline

return true if switch is ON

Definition at line 75 of file onoff_switch.h.

void stxxl::onoff_switch::off ( )
inline

turn switch OFF and notify one waiter

Definition at line 53 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 45 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 68 of file onoff_switch.h.

void stxxl::onoff_switch::wait_for_on ( )
inline

wait for switch to turn ON

Definition at line 61 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 34 of file onoff_switch.h.

mutex stxxl::onoff_switch::m_mutex
private

mutex for condition variable

Definition at line 31 of file onoff_switch.h.

bool stxxl::onoff_switch::m_on
private

the switch's state

Definition at line 37 of file onoff_switch.h.


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