#include <cxxtools/thread.h>
Inheritance diagram for AttachedThread:

Public Member Functions | |
| AttachedThread (const Callable< void > &cb) | |
| Contructs a thread with a thread entry. | |
| ~AttachedThread () | |
| Joins the thread, if not already joined. | |
| void | join () |
| Wait explicitly for the thread to terminate. | |
| void | terminate () |
| Terminates the thread. | |
Example:
struct Operation { void run() { // implement, whatever needs to be done in parallel } }; int main() { Operation op; cxxtools::Thread thread( cxxtools::callable(op, &Operation::run) ); thread.start(); // the thread runs and we can do something else in parallel doMoreWork(); // the thread's destructor waits for the thread to join // the op object outlives the thread object return 0; }
| AttachedThread | ( | const Callable< void > & | cb | ) | [explicit] |
| void join | ( | ) |
Join() is called automatically in the destructor if not already called. Throws SystemError on failure
Reimplemented from Thread.
| void terminate | ( | ) |
Forces the thread to terminate is dangerous and discouraged.
Reimplemented from Thread.