Provides a mean to execute some job exactly once during the lifetime of a programm and using multiple threads. More...
#include <xdispatch/once.h>
Classes | |
| class | once_block |
Public Member Functions | |
| once () | |
| Creates a new once object, marked as not having been executed yet. | |
| once (dispatch_once_t *) | |
| Creates a new once object, the execution state is shared with the given dispatch_once_t object. | |
| dispatch_once_t * | native_once () const |
| void | operator() (operation &) |
| Executes the given operation when the once object has not executed any operation on before and on the current or any other thread. | |
| void | operator() (dispatch_block_t b) |
| Similar to operator()(operation&) | |
Friends | |
| std::ostream & | operator<< (std::ostream &, const once &) |
Provides a mean to execute some job exactly once during the lifetime of a programm and using multiple threads.
This can be very handy when e.g. allocating resources.
Creates a new once object, marked as not having been executed yet.
Creates a new once object, the execution state is shared with the given dispatch_once_t object.
| dispatch_once_t* xdispatch::once::native_once | ( | ) | const |
| void xdispatch::once::operator() | ( | operation & | ) |
Executes the given operation when the once object has not executed any operation on before and on the current or any other thread.
| void xdispatch::once::operator() | ( | dispatch_block_t | b | ) | [inline] |
Similar to operator()(operation&)
Will wrap the given block as operation and try to execute it on the once object
| std::ostream& operator<< | ( | std::ostream & | , |
| const once & | |||
| ) | [friend] |