class represents posix pthread functionality
More...
#include <dabc/threads.h>
class represents posix pthread functionality
Definition at line 340 of file threads.h.
◆ StartRoutine
typedef void*() dabc::PosixThread::StartRoutine(void *) |
◆ PosixThread()
dabc::PosixThread::PosixThread |
( |
| ) |
|
◆ ~PosixThread()
dabc::PosixThread::~PosixThread |
( |
| ) |
|
|
virtual |
◆ UseCurrentAsSelf()
void dabc::PosixThread::UseCurrentAsSelf |
( |
| ) |
|
|
inlineprotected |
◆ SetAffinity()
bool dabc::PosixThread::SetAffinity |
( |
const char * |
aff | ) |
|
Sets affinity mask for the thread.
Should be called before thread is started.
- Parameters
-
[in] | aff | can be
- unsigned value with processors mask
- string like "xxxoooxxx" were x and o identified enabled and disabled processors, first element in string corresponds to first processor -string like "+M" where M is processor number in special processors set, before SetDfltAffinity("-N") should be called (M<N)
|
Definition at line 286 of file threads.cxx.
◆ GetAffinity()
bool dabc::PosixThread::GetAffinity |
( |
bool |
actual, |
|
|
char * |
buf, |
|
|
unsigned |
maxbuf |
|
) |
| |
Provides thread affinity in form of "xxxooooo".
See SetAffinity method for more information
- Parameters
-
[in] | actual | if true, request will be done to the thread, otherwise configured value will be provided |
[out] | buf | output buffer |
[out] | maxbuf | size of output buffer |
- Returns
- true if operation was executed without error.
Definition at line 451 of file threads.cxx.
◆ Start() [1/2]
void dabc::PosixThread::Start |
( |
Runnable * |
run | ) |
|
Start thread with provided runnable.
Definition at line 358 of file threads.cxx.
◆ Start() [2/2]
void dabc::PosixThread::Start |
( |
StartRoutine * |
func, |
|
|
void * |
args |
|
) |
| |
Start thread with provided routine and call arguments.
Definition at line 382 of file threads.cxx.
◆ Join()
void dabc::PosixThread::Join |
( |
| ) |
|
Join thread - method waits until thread execution is completed.
Definition at line 389 of file threads.cxx.
◆ Kill()
void dabc::PosixThread::Kill |
( |
int |
sig = 9 | ) |
|
Kill thread with specified signal.
Definition at line 407 of file threads.cxx.
◆ Cancel()
void dabc::PosixThread::Cancel |
( |
| ) |
|
Try to cancel thread execution.
Definition at line 412 of file threads.cxx.
◆ SetPriority()
void dabc::PosixThread::SetPriority |
( |
int |
prio | ) |
|
◆ SetThreadName()
void dabc::PosixThread::SetThreadName |
( |
const char * |
thrdname | ) |
|
Set thread name, which can be seen from htop.
Definition at line 417 of file threads.cxx.
◆ Id()
Thread_t dabc::PosixThread::Id |
( |
| ) |
const |
|
inline |
- Returns
- handle of thread object.
Definition at line 398 of file threads.h.
◆ Self()
static Thread_t dabc::PosixThread::Self |
( |
| ) |
|
|
inlinestatic |
- Returns
- handle of current thread.
Definition at line 401 of file threads.h.
◆ IsItself()
bool dabc::PosixThread::IsItself |
( |
| ) |
const |
|
inline |
Returns true if called from thread context.
Definition at line 404 of file threads.h.
◆ SetDfltAffinity()
bool dabc::PosixThread::SetDfltAffinity |
( |
const char * |
aff = nullptr | ) |
|
|
static |
Sets default affinity for next threads to be created and for main process.
- Parameters
-
[in] | aff | could be:
- unsigned value with processors mask
- string like "xxxoooxxxss" with allowed symbols 'x', 'o' and 's'. 'x' - enabled, 'o' - disabled, 's' - special purpose first element in string corresponds to first processor
- string like "-N" where N is processors number which should be reserved for special purposes, these processors could be later assigned with SetAffinity("+M") call (M<N)
|
- Returns
- true if successful
Definition at line 183 of file threads.cxx.
◆ GetDfltAffinity()
bool dabc::PosixThread::GetDfltAffinity |
( |
char * |
buf, |
|
|
unsigned |
maxbuf |
|
) |
| |
|
static |
Returns default affinity mask in form "xxxooosss".
See SetDfltAffinity for more details
Definition at line 424 of file threads.cxx.
◆ fThrd
pthread_t dabc::PosixThread::fThrd |
|
protected |
◆ fCpuSet
cpu_set_t dabc::PosixThread::fCpuSet |
|
protected |
affinity property of the thread
Definition at line 343 of file threads.h.
◆ fDfltSet
cpu_set_t dabc::PosixThread::fDfltSet |
|
staticprotected |
default affinity for new thread
Definition at line 344 of file threads.h.
◆ fSpecialSet
cpu_set_t dabc::PosixThread::fSpecialSet |
|
staticprotected |
set of processors, which can be used for special threads
Definition at line 345 of file threads.h.
The documentation for this class was generated from the following files: