B2BITS FIX Antenna C++ 2.33.0
|
A thread of execution in a program. More...
#include <B2BITS_Thread.h>
Public Types | |
enum | Priority { DefaultPriority , IdlePriority , LowestPriority , LowPriority , NormalPriority , HighPriority , HighestPriority , RealtimePriority } |
Thread priority. More... | |
typedef void(* | ThreadListener) () |
Public Member Functions | |
virtual void | cancel () |
Requests that thread to be canceled. | |
void | destroyOnExit (bool value) throw () |
Set to true to destroy thread on exit. | |
bool | equals (ThreadId thrId) |
ThreadId | getId () const |
Returns thread's id. | |
std::string const & | getName () const |
Returns the thread's name. | |
void | join () |
Waits for this thread to terminate. | |
bool | join (unsigned int milliseconds) |
Waits for this thread to terminate. | |
void | setAffinity (const System::affinity256_t &mask) throw () |
Sets CPU affinity. | |
void | setPriority (Priority p) throw () |
Sets thread priority. | |
virtual void | start () |
Causes this thread to begin execution. | |
Thread (bool setExTranslator=true) | |
Constructor. | |
Thread (const char *pName, bool setExTranslator=true) | |
Constructor. | |
Thread (const std::string &aName, bool setExTranslator=true) | |
void | updateName (std::string const &name) |
Update thread name before starting. | |
virtual | ~Thread () |
Destructor. | |
Static Public Member Functions | |
static void | callThreadStartListener () throw () |
static void | callThreadStopListener () throw () |
static void | getSelfName (std::string &res) |
get name of the current thread | |
static ThreadListener | getThreadStartListener () throw () |
static ThreadListener | getThreadStopListener () throw () |
static u64 | prepareUSleep (unsigned int delayUs) throw () |
Calculates uSleepDelay value based on given microsecond time span. | |
static ThreadId | self () |
Returns the thread ID of the calling thread. | |
static void | setCurrentThreadAffinity (const System::affinity256_t &mask) |
Sets CPU affinity for current thread. | |
static void | setCurrentThreadPriority (Priority p) |
Sets priority for current thread. | |
static void | setName (char const *name) |
Gives name to the current thread. | |
static void | setThreadStartListener (ThreadListener listener) throw () |
static void | setThreadStopListener (ThreadListener listener) throw () |
static bool | sleep (unsigned int aMillis) |
Causes the currently executing thread to sleep for the specified number of milliseconds. | |
static void | uSleep (u64 uSleepDelay) throw () |
Performs busy wait using Thread::yield method. | |
static void | yield () throw () |
Causes the currently executing thread object to temporarily pause and allow other threads to execute. | |
Protected Types | |
enum | CancellationType { DISABLED , DEFERRED , ASYNCHRONOUS } |
Protected Member Functions | |
void | afterRun () |
void | beforeRun () |
virtual void | run ()=0 |
Thread's start function. | |
void | setCancelMode (CancellationType aMode) |
Sets thread's cancellation mode. | |
A thread of execution in a program.
typedef void(* System::Thread::ThreadListener) () |
|
protected |
Thread priority.
|
explicit |
Constructor.
When a new thread is created, it does not begin immediate execution.
setExTranslator | - valid for the Windows platform only. When true SEH exceptions will be translated into the Utils::Exception. |
SystemException |
|
explicit |
Constructor.
When a new thread is created, it does not begin immediate execution.
pName | - Thread name |
setExTranslator | - valid for the Windows platform only. When true SEH exceptions will be translated into the Utils::Exception. |
SystemException |
|
explicit |
|
virtual |
Destructor.
|
protected |
|
protected |
|
inlinestatic |
|
inlinestatic |
|
virtual |
Requests that thread to be canceled.
Cancellation is asynchronous. Use join() to wait for termination of thread if necessary. You should never use cancellation unless you really want the target thread to go away. This is a termination mechanism.
SystemException |
|
inline |
Set to true to destroy thread on exit.
bool System::Thread::equals | ( | ThreadId | thrId | ) |
|
inline |
Returns thread's id.
|
inline |
Returns the thread's name.
|
static |
get name of the current thread
|
static |
|
static |
void System::Thread::join | ( | ) |
Waits for this thread to terminate.
SystemException |
bool System::Thread::join | ( | unsigned int | milliseconds | ) |
Waits for this thread to terminate.
milliseconds | - timeout in milliseconds |
SystemException |
|
static |
Calculates uSleepDelay value based on given microsecond time span.
Value should be passed to Thread::uSleep method. This method was intended to minimize overhead of Thread::uSleep.
delayUs | Delay. Microseconds. Can be zero. |
|
protectedpure virtual |
|
static |
Returns the thread ID of the calling thread.
void System::Thread::setAffinity | ( | const System::affinity256_t & | mask | ) | ||
throw | ( | ) |
Sets CPU affinity.
There is no waranty for this method.
|
protected |
Sets thread's cancellation mode.
SystemException |
|
static |
Sets CPU affinity for current thread.
mask | Affinity mask for calling thread. |
|
static |
Sets priority for current thread.
p | priority for calling thread. |
|
static |
Gives name to the current thread.
name | New name |
void System::Thread::setPriority | ( | Priority | p | ) | ||
throw | ( | ) |
Sets thread priority.
There is no waranty for this method.
|
static |
|
static |
|
static |
Causes the currently executing thread to sleep for the specified number of milliseconds.
It is a cancellation point.
SystemException |
|
virtual |
Causes this thread to begin execution.
SystemException |
|
inline |
Update thread name before starting.
name | - new name to be assigned to the thread |
|
static |
Performs busy wait using Thread::yield method.
Methods blocks execution on given uSleepDelay time, which is calculated by Thread::prepareUSleep method.
uSleepDelay | Delay value which is calculated by Thread::prepareUSleep method. |
|
static |
Causes the currently executing thread object to temporarily pause and allow other threads to execute.
SystemException |