acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
task_context.h
1
// Deeply refactored by camilo on 2024-10-07 07:24 <3ThomasBorregaardSorensen!!
2
// More deep refactoring merging post_procedure_continuation by
3
// camilo on 2024-10-09 11:31 <3ThomasBorregaardSorensen!!
4
// post_procedure_continuation
5
// camilo on 2024-10-08 08:45 <3ThomasBorregaardSorensen!!
6
#pragma once
7
8
9
class
task_context_base
;
10
11
12
inline
static
thread_local
task_context_base
* t_ptaskcontextbaseRoot;
13
14
class
CLASS_DECL_ACME
task_context_base
:
15
virtual
public
::particle
16
{
17
public
:
18
19
task_context_base
* m_pParent;
20
21
22
static
task_context_base
* current() {
return
t_ptaskcontextbaseRoot; }
23
void
push()
24
{
25
26
auto
pNewParent = t_ptaskcontextbaseRoot;
27
28
t_ptaskcontextbaseRoot =
this
;
29
30
t_ptaskcontextbaseRoot->m_pParent = pNewParent;
31
32
}
33
34
35
void
pop()
36
{
37
38
auto
pParent = t_ptaskcontextbaseRoot->m_pParent;
39
40
t_ptaskcontextbaseRoot = pParent;
41
42
}
43
44
};
45
46
class
stack_task_context_base
47
{
48
public
:
49
task_context_base
* m_p;
50
51
stack_task_context_base(
task_context_base
* p) :
52
m_p(p)
53
{
54
m_p->push();
55
56
}
57
58
~stack_task_context_base()
59
{
60
61
m_p->pop();
62
63
m_p =
nullptr
;
64
}
65
66
};
67
68
69
template
<
typename
CONTEXT_TYPE >
70
class
task_context :
71
virtual
public
::task_context_base
72
{
73
public
:
74
75
task_context()
76
{
77
78
}
79
~task_context()
override
80
{
81
82
}
83
84
};
85
86
87
task_context_base
Definition
task_context.h:16
parallelization
task_context.h
Generated by
1.17.0