IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
task_thread_pool.hxx
Go to the documentation of this file.
1
3
4#pragma once
5#include <ice/task_types.hxx>
7#include <ice/native_aio.hxx>
8#include <ice/string.hxx>
9#include <ice/span.hxx>
10
11namespace ice
12{
13
25
27 {
28 public:
29 virtual ~TaskThreadPool() noexcept = default;
30 virtual auto thread_count() const noexcept -> ice::ncount = 0;
31 virtual auto managed_thread_count() const noexcept -> ice::ncount = 0;
32 virtual auto estimated_task_count() const noexcept -> ice::ncount = 0;
33
37 virtual auto create_thread(ice::StringID name) noexcept -> ice::TaskThread& = 0;
38
42 virtual auto find_thread(ice::StringID name) noexcept -> ice::TaskThread* = 0;
43
47 virtual bool destroy_thread(ice::StringID name) noexcept = 0;
48
55 virtual auto attach_thread(
56 ice::StringID name,
57 //ice::TaskFlags accepting_flags,
58 ice::UniquePtr<ice::TaskThread> thread
59 ) noexcept -> ice::TaskThread& = 0;
60
64 virtual auto detach_thread(
65 ice::StringID name
66 ) noexcept -> ice::UniquePtr<ice::TaskThread> = 0;
67 };
68
72 ice::TaskThreadPoolCreateInfo const& threadpool_info
73 ) noexcept -> ice::UniquePtr<ice::TaskThreadPool>;
74
75} // namespace ice
Definition task_queue.hxx:13
Definition task_thread.hxx:49
Definition task_thread_pool.hxx:27
virtual auto attach_thread(ice::StringID name, ice::UniquePtr< ice::TaskThread > thread) noexcept -> ice::TaskThread &=0
Attaches a user created thread to the pool.
virtual auto detach_thread(ice::StringID name) noexcept -> ice::UniquePtr< ice::TaskThread >=0
Detaches a previously user created thread from the pool.
virtual auto create_thread(ice::StringID name) noexcept -> ice::TaskThread &=0
Creates an additonal thread with the given name (ID).
virtual ~TaskThreadPool() noexcept=default
virtual auto estimated_task_count() const noexcept -> ice::ncount=0
virtual auto find_thread(ice::StringID name) noexcept -> ice::TaskThread *=0
Finds a thread created or attached with the given name.
virtual bool destroy_thread(ice::StringID name) noexcept=0
Destroyes a previosuly created or attached thread with the given name.
virtual auto managed_thread_count() const noexcept -> ice::ncount=0
virtual auto thread_count() const noexcept -> ice::ncount=0
struct AIOPortInternal * AIOPort
Definition native_aio.hxx:10
Definition queue.hxx:111
SPDX-License-Identifier: MIT.
Definition array.hxx:12
ice::BasicString< char > String
Definition string.hxx:82
auto create_thread_pool(ice::Allocator &alloc, ice::TaskQueue &queue, ice::TaskThreadPoolCreateInfo const &threadpool_info) noexcept -> ice::UniquePtr< ice::TaskThreadPool >
auto alloc(ice::usize size) noexcept -> ice::AllocResult
BaseStringID< ice::build::Constant_StringID_DebugInfoEnabled > StringID
\copy ice::BaseStringID.
Definition stringid.hxx:15
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition mem_types.hxx:25
Definition task_thread_pool.hxx:15
ice::ncount thread_count
The thread count of this thread pool.
Definition task_thread_pool.hxx:17
ice::String debug_name_format
May be ignored in some builds.
Definition task_thread_pool.hxx:23
ice::native_aio::AIOPort aioport
The AIO port to be used for internal AIO threads.
Definition task_thread_pool.hxx:20
Definition mem_unique_ptr.hxx:25
Definition ncount.hxx:14