summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-10 21:37:01 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-10 21:37:01 +0200
commit5e314fd0ebe500d3ba396a09c8984627beff2f37 (patch)
tree7d40f5d75bd56e0868950b5d06c2251e2ffe267f
parent097a84d8d1a041a66c9b0b51c7f89e70dec13b0a (diff)
Make sure all tasks but one have a parent
-rw-r--r--uring.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/uring.c b/uring.c
index c8e1dbb..347c7fc 100644
--- a/uring.c
+++ b/uring.c
@@ -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");