acme
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
Functions
Enumerations
Enumerator
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
z
~
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
z
~
Variables
Typedefs
Files
File List
File Members
All
Functions
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Pages
Concepts
Loading...
Searching...
No Matches
parallelization
task_keep.h
1
// Created by camilo on 2022-06-09 14:31 BRT <3ThomasBorregaardSorensen!! and Mummi and bilbo!!
2
#pragma once
3
4
5
#include "acme/platform/keep.h"
6
7
8
#define __keep_current_thread(...) auto COUNTER_TOKEN(__keep_current_thread) = keep(__VA_ARGS__, ::get_task())
9
10
11
template
< >
12
inline ::task* default_keep_value < ::task* >()
13
{
14
15
return ::get_task();
16
17
}
18
19
#define __task_guard_ret(flag, ret) \
20
\
21
synchronous_lock synchronouslock(this->synchronization()); \
22
\
23
if (flag) \
24
{ \
25
\
26
ret; \
27
\
28
} \
29
\
30
auto COUNTER_TOKEN(__task_guard_task_ret) = keep(flag); \
31
\
32
synchronouslock.unlock()
33
34
#define __task_guard(flag) __task_guard_ret(flag, return)
35
36
37
#define __guard_wait_ret(flag, ret) \
38
\
39
synchronous_lock synchronouslock(this->synchronization()); \
40
\
41
while (flag) \
42
{ \
43
\
44
\
45
synchronouslock.unlock(); \
46
\
47
if (!task_sleep(100_ms)) \
48
{\
49
\
50
ret; \
51
\
52
} \
53
\
54
synchronouslock.lock(); \
55
\
56
\
57
} \
58
\
59
auto COUNTER_TOKEN(__guard_wait_ret) = keep(&flag); \
60
\
61
synchronouslock.unlock()
62
63
#define __guard_wait(flag) __task_guard_ret(flag, return)
64
65
Generated by
1.13.2