thread#

Fully qualified name: carb::thread

namespace thread#

Namespace for all threading operations.

Classes#

AtomicBackoff

A utility class for providing a growing number of pause instructions, followed by yielding.

ThreadLocal

Base template.

ThreadLocal< T, false >

A class for declaring a dynamic thread-local variable (Large/Non-trivial specialization).

ThreadLocal< T, true >

A class for declaring a dynamic thread-local variable (Trivial/Pointer/POD specialization).

mutex

A Carbonite implementation of std::mutex .

recursive_mutex

A Carbonite implementation of std::recursive_mutex .

recursive_shared_mutex

A recursive shared mutex.

shared_mutex

A shared mutex implementation conforming to C++17's shared_mutex .

Enumerations#

RelayResult

Possible result codes for Framework::runRelayTask().

Functions#

CpuMaskVector getAffinity(NativeHandleType h)

Gets the current CPU Affinity for the thread.

std::string getName(NativeHandleType h)

Retrieves the name of the thread previously set with setName() .

unsigned hardware_concurrency() noexcept

Similar to std::thread::hardware_concurrency() , but pays attention to docker cgroup config and CPU limits.

void setAffinity(NativeHandleType h, size_t mask)

Sets the CPU affinity for the given thread handle.

bool setAffinity(NativeHandleType h, const CpuMaskVector &masks)

Sets the CPU Affinity for the thread.

void setName(NativeHandleType h, const char *name)

Sets the name of the given thread.

Namespaces#

detail

Namespace for Carbonite private threading details.

Structs#

IThreadUtil

An interface to provide various thread utility operations.

RelayTaskDesc

A descriptor of the relay task to be performed.

futex

Futex namespace.

Typedefs#

CpuMaskVector

Each entry in the vector is a bitmask for a set of CPUs.

ProcessId

The type for a process ID.

RecursiveSpinlock

A spinlock implementation that allows recursion.

RelayFlags

Base type for flags to the task relay system.

RelayTaskFn

Prototype for a relayed task function.

Spinlock

A spinlock implementation that does not allow recursion.

ThreadId

The type for a thread ID.

shared_lock

Alias for std::shared_lock .

Variables#

constexpr RelayFlags fRelayAvailableFlagsMask

Flags available for use in the relay task itself.

constexpr RelayFlags fRelayFlagBlocking

Flag to indicate that a relay task should block until the task completes.

constexpr RelayFlags fRelayFlagForce

Force the execution of the task even if a failure related to relaying the task occurs.

constexpr uint64_t kCpusPerMask

The number of CPUs represented by an individual cpu mask.