CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
ThreadPool.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
11
12#include <asio/thread_pool.hpp>
13
14namespace CeresEngine {
15
40 class ThreadPool : private asio::thread_pool, public ExecutionContext {
41 using Super = asio::thread_pool;
42
43 public:
44 using Super::Super;
45
46 public: // Thread pool
47 using Executor = Super::executor_type;
48
49 using Super::executor;
50 using Super::executor_type;
51 using Super::join;
52 using Super::stop;
53 using Super::wait;
54
55 public: // ExecutionContext interface
56 [[nodiscard]] AnyExecutor getExecutor() noexcept override { return executor(); }
57 };
58
59} // namespace CeresEngine
A context for function object execution.
Definition ExecutionContext.hpp:90
The thread pool class is an execution context where functions are permitted to run on one of a fixed ...
Definition ThreadPool.hpp:40
AnyExecutor getExecutor() noexcept override
Returns an executor that run execute scheduled commands on the context.
Definition ThreadPool.hpp:56
asio::thread_pool Super
Definition ThreadPool.hpp:41
Super::executor_type Executor
Definition ThreadPool.hpp:47
Definition Application.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25