ImFusion SDK 4.3
Multi-Threading Utilities

Utility classes for multi-threading. More...

+ Collaboration diagram for Multi-Threading Utilities:

Detailed Description

Utility classes for multi-threading.

Classes

class  PlaybackTimer
 Recurring timer class that allows for playback over a range at given timestamps/intervals. More...
 
class  StoppableThread
 Extension of a std::thread to allow for signalling the thread to abort its execution. More...
 
class  ThreadPool
 Lightweight implementation of a thread pool for distributing work onto a fixed number of threads. More...
 

Functions

void setCurrentThreadName (const std::string &threadName)
 Sets the current thread's name to the given string so that a debugger may show it as description.
 
std::optional< PrioritycurrentThreadPriority ()
 Queries the current thread's priority from the operating system or std::nullopt if an error occurred.
 
bool setCurrentThreadPriority (Priority priority)
 Sets the current thread's priority to the given value.
 
void runAsyncAndForget (std::function< void()> func)
 Launches the given function in a background thread using std::thread This function will return immediately and there is no built-in way to know when func has completed.
 

Function Documentation

◆ setCurrentThreadName()

void setCurrentThreadName ( const std::string & threadName)

#include <ImFusion/Core/Threading.h>

Sets the current thread's name to the given string so that a debugger may show it as description.

This functionality is platform-dependent and may not reliably work on all platforms.

◆ currentThreadPriority()

std::optional< Priority > currentThreadPriority ( )

#include <ImFusion/Core/Threading.h>

Queries the current thread's priority from the operating system or std::nullopt if an error occurred.

See also
setCurrentThreadPriority()

◆ setCurrentThreadPriority()

bool setCurrentThreadPriority ( Priority priority)

#include <ImFusion/Core/Threading.h>

Sets the current thread's priority to the given value.

It will not affect the scheduling of other threads or of the whole process.

Note
On Linux the main executable needs the CAP_SYS_NICE capability for the process to be able to modify its own priority, or an EACCES error will be reported.
Returns
True on success, false otherwise.
See also
makeCurrentThreadRealTime()
Search Tab / S to search, Esc to close