guts
Loading...
Searching...
No Matches
gthreads.h File Reference

Small compatibility wrapper providing a jthread-like type. More...

#include <thread>
Include dependency graph for gthreads.h:

Go to the source code of this file.

Data Structures

class  jthread_alias
 Fallback RAII "join-on-destruction" thread wrapper. More...
 

Detailed Description

This header defines jthread_alias, which maps to:

  • std::jthread when the standard library provides it (C++20 and library support), or
  • a minimal RAII wrapper around std::thread that joins on destruction otherwise.

The fallback is intentionally small and conservative: it provides only the subset of functionality used by the project. The intent is to avoid sprinkling conditional compilation throughout the codebase while still getting safe thread joining semantics.

Key contract for the fallback:

  • If a thread is started and still joinable at destruction, it is joined.
  • The wrapper is non-copyable and movable.
  • The API mirrors the std::thread subset that is needed (join, detach, id, native handle, swap).

Definition in file gthreads.h.