diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-10 21:37:01 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-10 21:37:01 +0200 |
commit | 5e314fd0ebe500d3ba396a09c8984627beff2f37 (patch) | |
tree | 7d40f5d75bd56e0868950b5d06c2251e2ffe267f | |
parent | 097a84d8d1a041a66c9b0b51c7f89e70dec13b0a (diff) |
Make sure all tasks but one have a parent
-rw-r--r-- | uring.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -142,8 +142,16 @@ uring_parent(struct cfg *cfg) } void -uring_task_init(struct uring_task *task, const char *name, struct uring_task *parent, void (*free)(struct uring_task *)) +uring_task_init(struct uring_task *task, const char *name, + struct uring_task *parent, void (*free)(struct uring_task *)) { + static bool first = true; + + if (first) + first = false; + else if (!parent) + die("uring_task_init called without a parent\n"); + if (!free) die("uring_task_init called without destructor\n"); |