![]() |
UtilsLite
Utilities for C++ programming
|
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 & > |
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.
#define UTILS_BARRIER Utils::Barrier |
#define UTILS_MUTEX std::mutex |
#define UTILS_SEMAPHORE Utils::SimpleSemaphore |
#define UTILS_SPINLOCK Utils::SpinLock |
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.
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.
auto Utils::at_scope_exit | ( | Function const & | fun | ) | -> at_scope_exit_impl<Function const &> |