From 5e314fd0ebe500d3ba396a09c8984627beff2f37 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Wed, 10 Jun 2020 21:37:01 +0200 Subject: Make sure all tasks but one have a parent --- uring.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'uring.c') 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"); -- cgit v1.2.3