IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
tasks
public
ice
task_queue.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/task_types.hxx
>
6
#include <
ice/task_awaitable.hxx
>
7
#include <
ice/atomic_linked_queue.hxx
>
8
9
namespace
ice
10
{
11
12
class
TaskQueue
final
13
{
14
public
:
15
TaskQueue
(
ice::TaskFlags
flags
= {})
noexcept
;
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
;
21
bool
push_back
(
ice::AtomicLinkedQueueRange<ice::TaskAwaitableBase>
awaitable_range)
noexcept
;
22
23
bool
contains
(
ice::TaskAwaitableBase
* awaitable)
const
noexcept
;
24
25
[[nodiscard]]
26
auto
take_front
() noexcept ->
ice
::
TaskAwaitableBase
*;
27
[[nodiscard]]
28
auto
take_all
() noexcept ->
ice
::
AtomicLinkedQueueRange
<
ice
::
TaskAwaitableBase
>;
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
41
ice
::
TaskFlags
const
flags
;
42
43
private:
44
ice
::
AtomicLinkedQueue
<
ice
::
TaskAwaitableBase
> _awaitables;
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
atomic_linked_queue.hxx
ice::TaskQueue::flags
ice::TaskFlags const flags
Flags of task allowed to be pushed onto this queue.
Definition
task_queue.hxx:41
ice::TaskQueue::not_empty
bool not_empty() const noexcept
Definition
task_queue.hxx:18
ice::TaskQueue::TaskQueue
TaskQueue(ice::TaskFlags flags={}) noexcept
ice::TaskQueue::take_front
auto take_front() noexcept -> ice::TaskAwaitableBase *
ice::TaskQueue::is_empty
bool is_empty() const noexcept
Definition
task_queue.hxx:17
ice::TaskQueue::take_all
auto take_all() noexcept -> ice::AtomicLinkedQueueRange< ice::TaskAwaitableBase >
ice::TaskQueue::contains
bool contains(ice::TaskAwaitableBase *awaitable) const noexcept
ice::TaskQueue::process_all
auto process_all(void *result_value=nullptr) noexcept -> ice::ncount
ice::TaskQueue::process_one
bool process_one(void *result_value=nullptr) noexcept
ice::TaskQueue::wait_any
void wait_any() noexcept
ice::TaskQueue::push_back
bool push_back(ice::AtomicLinkedQueueRange< ice::TaskAwaitableBase > awaitable_range) noexcept
ice::TaskQueue::push_back
bool push_back(ice::TaskAwaitableBase *awaitable) noexcept
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::AtomicLinkedQueue
Definition
atomic_linked_queue.hxx:16
ice::AtomicLinkedQueueRange
Definition
atomic_linked_queue.hxx:47
ice::TaskAwaitableBase
Definition
task_awaitable.hxx:36
ice::TaskFlags
Definition
task_flags.hxx:42
ice::ncount
Definition
ncount.hxx:14
task_awaitable.hxx
task_types.hxx
Generated by
1.18.0