![]() |
UtilsLite
Utilities for C++ programming
|
Fake thread pool class. More...
#include <ThreadPool0.hxx>
Public Member Functions | |
ThreadPool0 (unsigned n) | |
Constructs a fake thread pool with a specified number of threads. | |
virtual | ~ThreadPool0 ()=default |
Destructor. | |
void | exec (FUN &&fun) override |
Executes a given function in the current thread. | |
void | wait () override |
No-op method to wait for all tasks to complete. | |
unsigned | thread_count () const override |
Returns the number of threads in the pool. | |
char const * | name () const override |
![]() | |
ThreadPoolBase (ThreadPoolBase const &)=delete | |
ThreadPoolBase (ThreadPoolBase &&)=delete | |
ThreadPoolBase & | operator= (ThreadPoolBase const &)=delete |
ThreadPoolBase & | operator= (ThreadPoolBase &&)=delete |
ThreadPoolBase ()=default | |
template<typename Func, typename... Args> | |
void | run (Func &&func, Args &&... args) |
Static Public Member Functions | |
static char const * | Name () |
Returns the name of the thread pool. | |
Additional Inherited Members | |
![]() | |
typedef std::function< void(void)> | FUN |
Fake thread pool class.
This class simulates a thread pool by executing tasks in the calling thread, providing a simple interface for task execution without actual multi-threading capabilities.
It is primarily used for testing or environments where threading is not needed.
|
inlineexplicit |
Constructs a fake thread pool with a specified number of threads.
This constructor initializes the thread pool with a specified number of threads, although it does not actually create any threads. The specified number is ignored.
|
virtualdefault |
Destructor.
|
inlineoverridevirtual |
Executes a given function in the current thread.
This method takes a function and executes it immediately in the calling thread. No actual thread pooling is performed.
fun | The function to be executed. |
Implements Utils::ThreadPoolBase.
|
inlinestatic |
Returns the name of the thread pool.
This method returns a string describing the type of thread pool.
|
inlineoverridevirtual |
Implements Utils::ThreadPoolBase.
|
inlineoverridevirtual |
Returns the number of threads in the pool.
This method returns the number of threads in the pool, which is always 1 for this fake thread pool.
Implements Utils::ThreadPoolBase.
|
inlineoverridevirtual |
No-op method to wait for all tasks to complete.
This method does not perform any actions, as there are no threads or tasks to wait for.
Implements Utils::ThreadPoolBase.