nlib
nn::nlib::threading::this_thread Namespace Reference

Implements functions related to current thread behavior. More...

Functions

errno_t YieldThread () noexcept
 Yields control to a different thread. More...
 
errno_t Sleep (const TimeSpan &span) noexcept
 Makes the thread sleep for a specified period of time. More...
 
errno_t SleepMilliSeconds (unsigned int millisec) noexcept
 Makes the thread sleep for a specified period of time. More...
 
nlib_thread_id GetId () noexcept
 Gets the current thread ID. More...
 
errno_t GetCpu (int *cpuid) noexcept
 Gets the CPU on which the called thread is executing. More...
 
errno_t SetName (const char *literalString) noexcept
 Attaches a name to the thread. More...
 
errno_t GetPriority (int32_t *priority) noexcept
 Calls nlib_thread_getpriority and gets the thread's execution priority.
 
errno_t ChangePriority (int32_t priority) noexcept
 Calls nlib_thread_setpriority and sets the thread's execution priority.
 

Detailed Description

Implements functions related to current thread behavior.

Function Documentation

nn::nlib::threading::this_thread::GetCpu ( int *  cpuid)
inlinenoexcept

Gets the CPU on which the called thread is executing.

Parameters
[out]cpuidThe CPU number.
Returns
Returns the nlib_thread_getcpu return values.
Description
Runs nlib_thread_getcpu internally.

Definition at line 779 of file Thread.h.

nn::nlib::threading::this_thread::GetId ( )
inlinenoexcept

Gets the current thread ID.

Returns
Returns the current thread ID.
Examples:
misc/threading/tls/tls.cpp.

Definition at line 774 of file Thread.h.

nn::nlib::threading::this_thread::SetName ( const char *  literalString)
inlinenoexcept

Attaches a name to the thread.

Parameters
[in]literalStringThe thread name (a literal string).
Returns
Returns the nlib_thread_setname return values.
Description
Runs nlib_thread_setname.
Examples:
heap/object_tracking/object_tracking.cpp.

Definition at line 780 of file Thread.h.

nn::nlib::threading::this_thread::Sleep ( const TimeSpan span)
inlinenoexcept

Makes the thread sleep for a specified period of time.

Parameters
[in]spanSleep duration.
Returns
Returns 0.
Examples:
misc/threading/callonce/callonce.cpp, misc/threading/simpleringbuffer/simpleringbuffer.cpp, and misc/threading/tls/tls.cpp.

Definition at line 768 of file Thread.h.

nn::nlib::threading::this_thread::SleepMilliSeconds ( unsigned int  millisec)
inlinenoexcept

Makes the thread sleep for a specified period of time.

Parameters
[in]millisecSleep duration, in milliseconds.
Returns
Returns 0.
Examples:
misc/threading/criticalsection/criticalsection.cpp, misc/threading/future/future.cpp, and misc/threading/semaphore/semaphore.cpp.

Definition at line 771 of file Thread.h.

nn::nlib::threading::this_thread::YieldThread ( )
inlinenoexcept

Yields control to a different thread.

Returns
Returns 0.
Description
Makes an internal call to nlib_yield.
Examples:
msgpack/jsonrpc/jsonrpc.cpp, and msgpack/jsonrpc/server.cpp.

Definition at line 767 of file Thread.h.