UtilsLite
Utilities for C++ programming
Loading...
Searching...
No Matches
Thread Utilities

A collection of utilities for threading. More...

Namespaces

namespace  Utils::tp
 

Classes

class  Utils::ThreadPool0
 Fake thread pool class. More...
 
class  Utils::ThreadPool1
 Manages a pool of worker threads for concurrent task execution. More...
 
class  Utils::ThreadPool2
 Manages a pool of worker threads for concurrent task execution. More...
 
class  Utils::ThreadPool3
 A thread pool for concurrent task execution with worker management. More...
 
class  Utils::ThreadPool4
 A thread pool for concurrent task execution with worker management. More...
 
class  Utils::ThreadPool5
 A thread pool for concurrent task execution with worker management. More...
 
class  Utils::ThreadPoolBase
 
class  Utils::SpinLock
 
class  Utils::SpinLock_barrier
 
class  Utils::Barrier
 
class  Utils::SimpleSemaphore
 
class  Utils::WorkerLoop
 
class  Utils::WaitWorker
 
class  Utils::BinarySearch< DATA >
 
class  Utils::at_scope_exit_impl< Destructor >
 

Macros

#define UTILS_SEMAPHORE   Utils::SimpleSemaphore
 
#define UTILS_MUTEX   std::mutex
 
#define UTILS_SPINLOCK   Utils::SpinLock
 
#define UTILS_BARRIER   Utils::Barrier
 

Functions

template<class Function>
auto Utils::at_scope_exit (Function &&fun) -> at_scope_exit_impl< Function >
 
template<class Function>
auto Utils::at_scope_exit (Function const &fun) -> at_scope_exit_impl< Function const & >
 

Detailed Description

A collection of utilities for threading.

This module provides various utilities for managing threads and executing tasks concurrently. It includes functionalities such as thread pools, task management, and synchronization mechanisms.

Macro Definition Documentation

◆ UTILS_BARRIER

#define UTILS_BARRIER   Utils::Barrier

◆ UTILS_MUTEX

#define UTILS_MUTEX   std::mutex

◆ UTILS_SEMAPHORE

#define UTILS_SEMAPHORE   Utils::SimpleSemaphore

◆ UTILS_SPINLOCK

#define UTILS_SPINLOCK   Utils::SpinLock

Function Documentation

◆ at_scope_exit() [1/2]

template<class Function>
auto Utils::at_scope_exit ( Function && fun) -> at_scope_exit_impl<Function>

Create a variable that when destructed at the end of the scope executes a destructor function.

Template Parameters
Destructor&&destructor The destructor function, maybe a lambda function.

Use like this:

static int a = 0;

{ // Enter scope ++a; auto x1 = at_scope_exit([&](){ –a; } // Do something, possibly throwing an exception } // x1 goes out of scope, 'delete a' is called.

◆ at_scope_exit() [2/2]

template<class Function>
auto Utils::at_scope_exit ( Function const & fun) -> at_scope_exit_impl<Function const &>