dispenso
A library for task parallelism
 
Loading...
Searching...
No Matches
priority.h File Reference
#include <dispenso/platform.h>

Go to the source code of this file.

Enumerations

enum class  dispenso::ThreadPriority { kLow , kNormal , kHigh , kRealtime }
 

Functions

ThreadPriority dispenso::getCurrentThreadPriority ()
 
bool dispenso::setCurrentThreadPriority (ThreadPriority prio)
 

Detailed Description

Utilities for getting and setting thread priority. This is an attempt to unify concepts for thread priority usefully across multiple platforms. For finer control, use platform specific functionality.

Note
When using higher-than-normal priority, use caution! Too many threads running at too high priority can have a strong negative impact on the responsivity of the machine. Prefer to use realtime priority only for short running tasks that need to be very responsively run.

Definition in file priority.h.

Enumeration Type Documentation

◆ ThreadPriority

enum class dispenso::ThreadPriority
strong

A thread priority setting. Enum values in increasing order of priority.

Definition at line 29 of file priority.h.

Function Documentation

◆ getCurrentThreadPriority()

DISPENSO_DLL_ACCESS ThreadPriority dispenso::getCurrentThreadPriority ( )

Access the current thread priority as set by setCurrentThreadPriority.

Returns
The priority of the current thread
Note
If the current thread priority has been set via a platform-specific mechanism, this may return an incorrect value.

Definition at line 35 of file priority.cpp.

◆ setCurrentThreadPriority()

DISPENSO_DLL_ACCESS bool dispenso::setCurrentThreadPriority ( ThreadPriority  prio)

Set the current thread's priority

Parameters
prioThe priority to set to
Returns
true if the priority was modified, false otherwise.

Definition at line 194 of file priority.cpp.