70 static void sleep(
unsigned int milliseconds);
95 ThisThread(
const ThisThread &);
96 ThisThread & operator = (
const ThisThread &);
106 explicit Thread(
const std::string & name);
135 virtual void run() = 0;
#define ONIXS_FIXENGINE_API
static void spinWait(int microseconds)
Executes a singular instruction during the given number of microseconds.
static void priority(int priority)
Sets the priority for the current thread.
static void affinity(const CpuIndexes &cpuIndexes)
Sets the processor affinity mask for the current thread.
static void affinity(CpuIndex cpuIndex)
Sets the processor affinity mask for the current thread.
static void policy(int policy)
Sets the scheduling policy for the current thread.
static ThreadId id()
Gets the platform identifier for the current thread.
static void sleep(unsigned int milliseconds)
Suspends the execution of the current thread for a given amount of time in milliseconds.
CpuIndexes & cpuIndexes()
The collection of CPU indices.
~ThreadAffinity()
Destructs the instance.
const CpuIndexes & cpuIndexes() const
The read-only access to the index collection.
std::string toString()
Serializes the thread affinity to the string presentation.
ThreadAffinity(const std::string &str)
Constructs the thread affinity from the string presentation.
void join() const
Joins the thread completion.
virtual ~Thread()
Cleans up internal resources.
void start()
Creates and runs an actual thread.
bool stopRequested() const
Returns 'true' if a stop signal is sent to the thread by the stopAsync method or in a different way,...
ThreadId id() const
Returns the platform identifier.
void stopAsync()
Sends a stop signal to the thread.
Thread(const std::string &name)
Creates the Thread object without running a real thread.
size_t CpuIndex
Logical processors that a thread is allowed to run on (first logical CPU has index 0).
std::set< CpuIndex > CpuIndexes
pthread_t ThreadId
Type alias for thread identifier.