Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
Threading

🟩 Native threads, synchronization primitives, and a caller-owned task pool (see Threading library page for more details) More...

Classes

struct  SC::Mutex
 A native OS mutex to synchronize access to shared resources. More...
 
struct  SC::ConditionVariable
 A native OS condition variable. More...
 
struct  SC::Thread
 A native OS thread. More...
 
struct  SC::RWLock
 A Read-Write lock that allows multiple concurrent readers but only one writer. More...
 
struct  SC::Barrier
 A synchronization point that blocks threads until the required number of threads have reached it. More...
 
struct  SC::EventObject
 An automatically reset event object to synchronize two threads. More...
 
struct  SC::Semaphore
 A semaphore synchronization primitive that maintains a count for resource management. More...
 
struct  SC::ResultThreading
 Threading result retaining optional native and backend-stage details. More...
 
struct  SC::ThreadPoolTask
 A small task containing a function to execute that can be queued in the thread pool. More...
 
struct  SC::ThreadPool
 Simple thread pool that executes tasks in a fixed number of worker threads. More...
 

Enumerations

enum class  SC::ThreadingError : uint32_t {
  InvalidThreadFunction = 1 ,
  ThreadAlreadyStarted ,
  ThreadNotStarted ,
  ThreadCreationFailed ,
  ThreadJoinFailed ,
  ThreadDetachFailed ,
  ThreadPoolAlreadyCreated ,
  InvalidWorkerThreadCount ,
  ThreadPoolNotCreated ,
  TaskAlreadyQueued ,
  TaskInUseByAnotherThreadPool ,
  ThreadPoolThreadCreationFailed
}
 Stable error codes returned by the Threading library. More...
 
enum class  SC::ThreadingErrorDetail : uint32_t {
  None = 0 ,
  PosixPthreadCreate ,
  PosixPthreadJoin ,
  PosixPthreadDetach ,
  WindowsCreateThread ,
  WindowsWaitForSingleObject ,
  WindowsCloseHandle
}
 Stable detail identifying the native/backend stage of a Threading failure. More...
 

Functions

ResultErrorFormat SC::formatThreadingError (ThreadingError error, Span< char > output)
 Formats a canonical English Threading diagnostic into caller-owned storage.
 
ResultErrorFormat SC::formatThreadingError (Result result, Span< char > output)
 Formats a plain Result when it contains a Threading error.
 
ResultErrorFormat SC::formatThreadingError (ResultThreading result, Span< char > output)
 Formats a Threading result, including its native error number when available.
 

Detailed Description

🟩 Native threads, synchronization primitives, and a caller-owned task pool (see Threading library page for more details)

Enumeration Type Documentation

◆ ThreadingError

enum class SC::ThreadingError : uint32_t
strong

#include <ThreadingError.h>

Stable error codes returned by the Threading library.

◆ ThreadingErrorDetail

enum class SC::ThreadingErrorDetail : uint32_t
strong

#include <ThreadingError.h>

Stable detail identifying the native/backend stage of a Threading failure.

Function Documentation

◆ formatThreadingError() [1/3]

ResultErrorFormat SC::formatThreadingError ( Result result,
Span< char > output )
inline

#include <ThreadingErrorFormatter.h>

Formats a plain Result when it contains a Threading error.

◆ formatThreadingError() [2/3]

ResultErrorFormat SC::formatThreadingError ( ResultThreading result,
Span< char > output )
inline

#include <ThreadingErrorFormatter.h>

Formats a Threading result, including its native error number when available.

◆ formatThreadingError() [3/3]

ResultErrorFormat SC::formatThreadingError ( ThreadingError error,
Span< char > output )
inline

#include <ThreadingErrorFormatter.h>

Formats a canonical English Threading diagnostic into caller-owned storage.

This opt-in header owns the canonical strings. Applications can instead switch on ThreadingError and use ResultErrorFormatter with their own translated text.