Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
atomic_wait.h File Reference

C++17-compatible atomic wait/notify implementation. More...

#include <atomic>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <chrono>
#include <type_traits>
Include dependency graph for atomic_wait.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  kcenon::thread::atomic_wait_helper< T >
 Helper class to add wait/notify functionality to std::atomic. More...
 
class  kcenon::thread::atomic_with_wait< T >
 RAII wrapper to add wait/notify to atomic variables. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::thread
 Core threading foundation of the thread system library.
 

Detailed Description

C++17-compatible atomic wait/notify implementation.

Provides wait() and notify() operations for std::atomic that work in C++17, with automatic fallback to std::atomic's built-in versions when available in C++20.

This implementation uses mutex + condition_variable with optimizations:

  • Short spin-wait before blocking (cache-friendly)
  • Efficient waiter management
  • Proper memory ordering guarantees

Definition in file atomic_wait.h.