KJB
|
RAII class to manage an object of type kjb_pthread_attr_t. More...
#include <l_mt_pt_attr.h>
Public Member Functions | |
Pthread_attr () | |
initialize a generic attribute object. More... | |
~Pthread_attr () | |
destroy an attribute object. More... | |
int | setdetachstate (int state) |
set the detach flag. More... | |
int | set_detached () |
convenience synonym setdetachstate(KJB_PTHREAD_CREATE_DETACHED) More... | |
int | getdetachstate (int *state) |
obtain the detach setting of this object. More... | |
operator const kjb_c::kjb_pthread_attr_t * () | |
access thread attribute as const pointer. More... | |
RAII class to manage an object of type kjb_pthread_attr_t.
The kjb_pthread sublibrary, which wraps the Posix pthread library, uses an object of type kjb_pthread_attr_t to describe the attributes of a thread. Thread attributes are its "detach state," its stack size, and other things. See pthread_attr_init(3). A single attribute object may be used on multiple threads.
The attribute object must be created and destroyed, thus this RAII class exists to manage those tasks. Objects of this class are not copyable or assignable.
Currently this class does not support all thread attribute options, but a developer is welcome to add new ones to the C library wrapper (l_mt) and add WRAPPED calls through this class. Please do not call pthreads functions directly – use the wrapped calls in kjb_c.
Example.
|
inline |
initialize a generic attribute object.
|
inline |
destroy an attribute object.
|
inline |
obtain the detach setting of this object.
[out] | state | Pointer to int into which the state is written |
|
inline |
access thread attribute as const pointer.
|
inline |
convenience synonym setdetachstate(KJB_PTHREAD_CREATE_DETACHED)
|
inline |
set the detach flag.
flag | KJB_PTHREAD_CREATE_JOINABLE, KJB_PTHREAD_CREATE_DETACHED are the two valid values. |