IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
task_queue.hxx
Go to the documentation of this file.
1
3
4#pragma once
5#include <ice/task_types.hxx>
8
9namespace ice
10{
11
12 class TaskQueue final
13 {
14 public:
16
17 bool is_empty() const noexcept { return _awaitables.is_empty(); }
18 bool not_empty() const noexcept { return _awaitables.not_empty(); }
19
20 bool push_back(ice::TaskAwaitableBase* awaitable) noexcept;
22
23 bool contains(ice::TaskAwaitableBase* awaitable) const noexcept;
24
25 [[nodiscard]]
26 auto take_front() noexcept -> ice::TaskAwaitableBase*;
27 [[nodiscard]]
29
30 bool process_one(void* result_value = nullptr) noexcept;
31 auto process_all(void* result_value = nullptr) noexcept -> ice::ncount;
32
33 void wait_any() noexcept;
34
35 template<typename Value>
36 constexpr bool process_one(Value& result_value) noexcept;
37 template<typename Value>
38 constexpr auto process_all(Value& result_value) noexcept -> ice::ncount;
39
42
43 private:
45 };
46
47 template<typename Value>
48 inline constexpr bool TaskQueue::process_one(Value& result_value) noexcept
49 {
50 return this->process_one(reinterpret_cast<void*>(&result_value));
51 }
52
53 template<typename Value>
54 inline constexpr auto TaskQueue::process_all(Value& result_value) noexcept -> ice::ncount
55 {
56 return this->process_all(reinterpret_cast<void*>(&result_value));
57 }
58
59} // namespace ice
ice::TaskFlags const flags
Flags of task allowed to be pushed onto this queue.
Definition task_queue.hxx:41
bool not_empty() const noexcept
Definition task_queue.hxx:18
TaskQueue(ice::TaskFlags flags={}) noexcept
auto take_front() noexcept -> ice::TaskAwaitableBase *
bool is_empty() const noexcept
Definition task_queue.hxx:17
auto take_all() noexcept -> ice::AtomicLinkedQueueRange< ice::TaskAwaitableBase >
bool contains(ice::TaskAwaitableBase *awaitable) const noexcept
auto process_all(void *result_value=nullptr) noexcept -> ice::ncount
bool process_one(void *result_value=nullptr) noexcept
void wait_any() noexcept
bool push_back(ice::AtomicLinkedQueueRange< ice::TaskAwaitableBase > awaitable_range) noexcept
bool push_back(ice::TaskAwaitableBase *awaitable) noexcept
SPDX-License-Identifier: MIT.
Definition array.hxx:12
Definition atomic_linked_queue.hxx:16
Definition atomic_linked_queue.hxx:47
Definition task_awaitable.hxx:36
Definition task_flags.hxx:42
Definition ncount.hxx:14