diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-20 12:53:25 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-20 12:53:25 +0200 |
commit | e11014c0443ea687ad65a14b9124aa366da7984a (patch) | |
tree | 8c6642ed187dc71cc672cec9f3459aa75134eaa5 /main.h | |
parent | fc25e880dfb1f804742006bcdd15ac70d18b4144 (diff) |
Introduce helper for checking if a task is dead
Diffstat (limited to 'main.h')
-rw-r--r-- | main.h | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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; |