35 lines482 bytes
Newer
Older
-
+
commited
{line.log.rev}
on
8 months ago
37
1
#include "coroutine.h"
2
3
4
struct Task {
5
Future base;
6
Coroutine *cor;
7
Task_Entry entry;
8
void *param;
9
Future *awaiting_future;
10
bool canceled;
11
void *cancel_value;
12
};
13
14
15
static inline bool Task_IsCanceled(
16
Task *tsk
17
){
18
return tsk->canceled;
19
}
20
21
22
static inline bool Task_Await(
23
Task *tsk,
24
void **res
25
){
26
return Future_Await(&tsk->base, res);
27
}
28
29
30
static inline Future *Task_GetAwaitedFuture(
31
Task *tsk
32
){
33
return tsk->awaiting_future;
34
}
35