Files
Aurora.3/code/__defines/callback.dm
Fluffy 5cb7c8f38e Async as define (#17542)
* Atomization

* changelog

* this file wasn't supposed to be included here

---------

Co-authored-by: FluffyGhost <FluffyGhost>
2023-10-12 21:19:42 +00:00

20 lines
668 B
Plaintext

#define CALLBACK new /datum/callback
///Per the DM reference, spawn(-1) will execute the spawned code immediately until a block is met.
#define MAKE_SPAWN_ACT_LIKE_WAITFOR -1
///Create a codeblock that will not block the callstack if a block is met.
#define ASYNC spawn(MAKE_SPAWN_ACT_LIKE_WAITFOR)
#define INVOKE_ASYNC(proc_owner, proc_path, proc_arguments...) \
if ((proc_owner) == GLOBAL_PROC) { \
ASYNC { \
call(proc_path)(##proc_arguments); \
}; \
} \
else { \
ASYNC { \
/* Written with `0 ||` to avoid the compiler seeing call("string"), and thinking it's a deprecated DLL */ \
call(0 || proc_owner, proc_path)(##proc_arguments); \
}; \
}