NDEVR
API Documentation
ThreadFunctions

Forward declaration of LogPtr for log access. More...

Static Public Member Functions

static uint04 CurrentThreadID ()
 Gets the unique identifier of the current thread.
static String CurrentThreadName ()
 Gets the name of the current thread.
static bool IsPrimaryThread ()
 Checks whether the calling thread is the primary (main) thread.
static uint04 PrimaryThreadID ()
 Gets the unique identifier of the primary thread.
static void RequestConcurrentExecution (const StringView &name, const std::function< void()> &function)
 Requests that a function be executed concurrently on a separate thread.
static void RequestNoSleep (bool request_no_sleep, const LogPtr &log)
 Requests that the system prevent or allow the device to sleep.
static void RequestSleep (const TimeSpan &interval)
 Puts the current thread to sleep for a specified duration.
static void SetCurrentThreadName (const StringView &name)
 Sets the name of the current thread for debugging and identification.
static void SetPrimaryThreadID (uint04 primary_thread)
 Sets the thread ID that should be considered the primary thread.

Detailed Description

Forward declaration of LogPtr for log access.


Utility functions for querying and controlling the current thread.

Definition at line 48 of file Thread.h.

Member Function Documentation

◆ CurrentThreadID()

uint04 ThreadFunctions::CurrentThreadID ( )
static

Gets the unique identifier of the current thread.

Returns
The thread ID of the calling thread.

◆ CurrentThreadName()

String ThreadFunctions::CurrentThreadName ( )
static

Gets the name of the current thread.

Returns
The name assigned to the calling thread.

◆ IsPrimaryThread()

bool ThreadFunctions::IsPrimaryThread ( )
static

Checks whether the calling thread is the primary (main) thread.

Returns
True if the current thread is the primary thread, false otherwise.

◆ PrimaryThreadID()

uint04 ThreadFunctions::PrimaryThreadID ( )
static

Gets the unique identifier of the primary thread.

Returns
The thread ID of the primary thread.

◆ RequestConcurrentExecution()

void ThreadFunctions::RequestConcurrentExecution ( const StringView & name,
const std::function< void()> & function )
static

Requests that a function be executed concurrently on a separate thread.

Parameters
[in]nameA descriptive name for the concurrent task.
[in]functionThe function to execute concurrently.

References RequestSleep().

◆ RequestNoSleep()

void ThreadFunctions::RequestNoSleep ( bool request_no_sleep,
const LogPtr & log )
static

Requests that the system prevent or allow the device to sleep.

Parameters
[in]request_no_sleepTrue to prevent sleep, false to allow it.
[in]logThe log to record the request.

◆ RequestSleep()

void ThreadFunctions::RequestSleep ( const TimeSpan & interval)
static

Puts the current thread to sleep for a specified duration.

Parameters
[in]intervalThe time span to sleep.

Referenced by HardwareCommandQueue< t_type >::executeCommandBlocking(), RequestConcurrentExecution(), RealSenseServer::WorkerThread::run(), RealSenseMotor::update(), and DeviCounterSimulatorIO::waitForReadyRead().

◆ SetCurrentThreadName()

void ThreadFunctions::SetCurrentThreadName ( const StringView & name)
static

Sets the name of the current thread for debugging and identification.

Parameters
[in]nameThe name to assign to the current thread.

◆ SetPrimaryThreadID()

void ThreadFunctions::SetPrimaryThreadID ( uint04 primary_thread)
static

Sets the thread ID that should be considered the primary thread.

Parameters
[in]primary_threadThe thread ID to designate as primary.

The documentation for this class was generated from the following file: