this_thread#

Fully qualified name: carb::this_thread

namespace this_thread#

Namespace for utilities that operate on the current thread specifically.

Functions#

void atomic_fence_seq_cst() noexcept

A replacement function for std::atomic_thread_fence(std::memory_order_seq_cst) that performs better on some older compilers.

thread::NativeHandleType get()

Returns the native handle for the current thread.

thread::CpuMaskVector getAffinity()

Gets the current CPU Affinity for the current thread.

thread::ThreadId getId()

Retrieve the thread ID for the current thread.

std::string getName()

Retrieves the name of the current thread.

thread::ProcessId getProcessId()

Returns the ID of the currently executing process.

thread::ProcessId getProcessIdCached()

Get the ID of the currently executing process.

bool setAffinity(const thread::CpuMaskVector &masks)

Sets the CPU Affinity for the current thread.

void setAffinity(size_t mask)

Sets the affinity of the current thread.

void setName(const char *name)

Sets the name for the current thread.

void sleepForUs(uint32_t microseconds) noexcept

A simple sleep for the current thread that does not include the overhead of std::chrono .

void sleep_for(const std::chrono::duration< Rep, Period > &delay)

Blocks the execution of the current thread for at least the specified duration.

void sleep_until(const std::chrono::time_point< Clock, Duration > &when)

Blocks the execution of the current thread until at least the specified time.

bool spinTryWait(Func &&f) noexcept(noexcept(f()))

Calls a predicate until it returns true or a number of attempts have elapsed.

bool spinTryWaitWithBackoff(Func &&f) noexcept(noexcept(f()))

Calls a predicate until it returns true or a number of attempts have elapsed, backing off as time passes.

void spinWait(Func &&f) noexcept(noexcept(f()))

Calls a predicate repeatedly until it returns true .

void spinWaitWithBackoff(Func &&f) noexcept(noexcept(f()))

Calls a predicate until it returns true with progressively increasing delays between calls.