R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
IThreadPool.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Created by hugo on 06/12/2025
4** File description:
5** IThreadPool.hpp
6*/
7
8#pragma once
9
10#include <functional>
11#include <memory>
12#include <vector>
13
14namespace server {
15
23 public:
24 using Task = std::function<void()>;
25
26 virtual ~IThreadPool() = default;
27
32 virtual void enqueue(Task task) = 0;
33
37 virtual void start() = 0;
38
42 virtual void stop() = 0;
43
48 virtual size_t size() const = 0;
49 };
50
51} // namespace server
Interface for a thread pool.
virtual void start()=0
Start all threads in the pool.
virtual ~IThreadPool()=default
virtual size_t size() const =0
Get the number of threads in the pool.
std::function< void()> Task
virtual void enqueue(Task task)=0
Enqueue a task to be executed by the thread pool.
virtual void stop()=0
Stop all threads and clean up resources.