Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
onoff_switch Class Reference

Detailed Description

Definition at line 25 of file onoff_switch.hpp.

#include <onoff_switch.hpp>

Public Member Functions

 onoff_switch (bool flag=false)
 construct switch More...
 
 onoff_switch (const onoff_switch &)=delete
 non-copyable: delete copy-constructor 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...
 
onoff_switchoperator= (const onoff_switch &)=delete
 non-copyable: delete assignment operator 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

std::condition_variable cond_
 condition variable More...
 
std::mutex mutex_
 mutex for condition variable More...
 
bool on_
 the switch's state More...
 

Constructor & Destructor Documentation

onoff_switch ( bool  flag = false)
inlineexplicit

construct switch

Definition at line 38 of file onoff_switch.hpp.

onoff_switch ( const onoff_switch )
delete

non-copyable: delete copy-constructor

Member Function Documentation

bool is_on ( )
inline

return true if switch is ON

Definition at line 80 of file onoff_switch.hpp.

References onoff_switch::mutex_, and onoff_switch::on_.

void off ( )
inline

turn switch OFF and notify one waiter

Definition at line 56 of file onoff_switch.hpp.

References onoff_switch::cond_, onoff_switch::mutex_, and onoff_switch::on_.

void on ( )
inline

turn switch ON and notify one waiter

Definition at line 48 of file onoff_switch.hpp.

References onoff_switch::cond_, onoff_switch::mutex_, and onoff_switch::on_.

Referenced by request_with_waiters::notify_waiters(), and set_switch_handler::operator()().

onoff_switch& operator= ( const onoff_switch )
delete

non-copyable: delete assignment operator

void wait_for_off ( )
inline

wait for switch to turn OFF

Definition at line 72 of file onoff_switch.hpp.

References onoff_switch::cond_, onoff_switch::mutex_, and onoff_switch::on_.

void wait_for_on ( )
inline

wait for switch to turn ON

Definition at line 64 of file onoff_switch.hpp.

References onoff_switch::cond_, onoff_switch::mutex_, and onoff_switch::on_.

Referenced by block_prefetcher< BlockType, BidIteratorType >::wait(), and foxxll::wait_any().

Member Data Documentation

std::condition_variable cond_
private

condition variable

Definition at line 31 of file onoff_switch.hpp.

Referenced by onoff_switch::off(), onoff_switch::on(), onoff_switch::wait_for_off(), and onoff_switch::wait_for_on().

std::mutex mutex_
private

mutex for condition variable

Definition at line 28 of file onoff_switch.hpp.

Referenced by onoff_switch::is_on(), onoff_switch::off(), onoff_switch::on(), onoff_switch::wait_for_off(), and onoff_switch::wait_for_on().

bool on_
private

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