summaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-20 12:53:25 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-20 12:53:25 +0200
commite11014c0443ea687ad65a14b9124aa366da7984a (patch)
tree8c6642ed187dc71cc672cec9f3459aa75134eaa5 /main.h
parentfc25e880dfb1f804742006bcdd15ac70d18b4144 (diff)
Introduce helper for checking if a task is dead
Diffstat (limited to 'main.h')
-rw-r--r--main.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/main.h b/main.h
index 39c2440..7d14118 100644
--- a/main.h
+++ b/main.h
@@ -96,6 +96,21 @@ struct uring_task {
void *priv;
};
+#define assert_task_alive_or(lvl, t, cmd) \
+do { \
+ if (!(t)) { \
+ error("invalid task\n"); \
+ cmd; \
+ } \
+ \
+ if ((t)->dead) { \
+ debug((lvl), "task dead\n"); \
+ cmd; \
+ } \
+} while(0)
+
+#define assert_task_alive(lvl, t) assert_task_alive_or((lvl), (t), return)
+
struct cfg {
uid_t uid;
gid_t gid;