#include <thread.h>
Public Types | |
enum | Priority |
Public Member Functions | |
Thread (const SigC::Slot0< void > &slot, bool joinable=false) | |
Thread (const SigC::Slot0< void > &slot, unsigned long stacksize, bool joinable, bool bound, Priority priority=Normal) | |
Thread (const Thread &th) | |
~Thread () | |
Thread & | operator= (const Thread &th) |
bool | join () |
bool | operator== (const Thread &th) const |
bool | operator!= (const Thread &th) const |
Static Public Member Functions | |
static Thread | self () |
Classes | |
class | Exit |
Thread exit exception. More... |
Class representing a thread (lightweight process).
Thread priorities.
SigCX::Threads::Thread::Thread | ( | const SigC::Slot0< void > & | slot, | |
bool | joinable = false | |||
) |
Constructor.
Create a new thread, using slot as main function.
slot | Invoked as main function of the thread. | |
joinable | Wether the thread should be joinable or detached. |
SigCX::Threads::Thread::Thread | ( | const SigC::Slot0< void > & | slot, | |
unsigned long | stacksize, | |||
bool | joinable, | |||
bool | bound, | |||
Priority | priority = Normal | |||
) |
Constructor.
Create a new thread, using slot as main function. In general, avoid using this constructor, when you can use Thread::Thread(joinable).
slot | Invoked as main function of the thread. | |
stacksize | Initial stacksize for the thread (system default if stacksize == 0). | |
joinable | Wether the thread should be joinable or detached. | |
bound | If true , this thread will be scheduled in the system scope, otherwise the implementation is free to do scheduling in the process scope. The first variant is more expensive resource-wise, but generally faster. On some systems (e.g. Linux) all threads are bound. | |
priority | One of Low , Normal , High , Urgent . It is not guaranteed, that threads with different priorities really behave accordingly. On some systems (e.g. Linux) only root can increase priorities. On other systems (e.g. Solaris) there doesn't seem to be different scheduling for different priorities. All in all try to avoid being dependent on priorities. Use Normal here as a default. |
SigCX::Threads::Thread::Thread | ( | const Thread & | th | ) |
Copy constructor.
SigCX::Threads::Thread::~Thread | ( | ) |
Destructor.
bool SigCX::Threads::Thread::join | ( | ) |
Join thread.
Waits until the thread finishes., i.e. Thread::main(arg) returns. All resources of thread are released. The thread must have been created with joinable
== true
in the constructor.
true
on success. bool SigCX::Threads::Thread::operator== | ( | const Thread & | th | ) | const [inline] |
bool SigCX::Threads::Thread::operator!= | ( | const Thread & | th | ) | const [inline] |
static Thread SigCX::Threads::Thread::self | ( | ) | [static] |