R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
server::IThreadPool Class Referenceabstract

Interface for a thread pool. More...

#include <IThreadPool.hpp>

Inheritance diagram for server::IThreadPool:
Inheritance graph
Collaboration diagram for server::IThreadPool:
Collaboration graph

Public Types

using Task = std::function< void()>
 

Public Member Functions

virtual ~IThreadPool ()=default
 
virtual void enqueue (Task task)=0
 Enqueue a task to be executed by the thread pool.
 
virtual void start ()=0
 Start all threads in the pool.
 
virtual void stop ()=0
 Stop all threads and clean up resources.
 
virtual size_t size () const =0
 Get the number of threads in the pool.
 

Detailed Description

Interface for a thread pool.

Defines the basic API for a thread pool managing multiple worker threads.

Definition at line 22 of file IThreadPool.hpp.

Member Typedef Documentation

◆ Task

using server::IThreadPool::Task = std::function<void()>

Definition at line 24 of file IThreadPool.hpp.

Constructor & Destructor Documentation

◆ ~IThreadPool()

virtual server::IThreadPool::~IThreadPool ( )
virtualdefault

Member Function Documentation

◆ enqueue()

virtual void server::IThreadPool::enqueue ( Task  task)
pure virtual

Enqueue a task to be executed by the thread pool.

Parameters
taskTask function

Implemented in server::ThreadPool.

◆ size()

virtual size_t server::IThreadPool::size ( ) const
pure virtual

Get the number of threads in the pool.

Returns
number of threads

Implemented in server::ThreadPool.

◆ start()

virtual void server::IThreadPool::start ( )
pure virtual

Start all threads in the pool.

Implemented in server::ThreadPool.

◆ stop()

virtual void server::IThreadPool::stop ( )
pure virtual

Stop all threads and clean up resources.

Implemented in server::ThreadPool.


The documentation for this class was generated from the following file: