Fix: Always check pthread_create for failures
authorEric Wong <normalperson@yhbt.net>
Sun, 2 Oct 2022 16:13:43 +0000 (12:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 3 Oct 2022 14:38:40 +0000 (10:38 -0400)
pthread_create may fail with EAGAIN (which is no fault of the
programmer), so don't allow the check to be compiled out.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia2695ea6953b589ac8ab8b444fb668daee06a614

src/urcu-defer-impl.h

index 1c9628792ac494db61c870c204811b3f1df61d72..cbb0ca8565bfe2b52806e343f7f61d09117d6f8c 100644 (file)
@@ -417,7 +417,8 @@ static void start_defer_thread(void)
        urcu_posix_assert(!ret);
 
        ret = pthread_create(&tid_defer, NULL, thr_defer, NULL);
-       urcu_posix_assert(!ret);
+       if (ret)
+               urcu_die(ret);
 
        ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
        urcu_posix_assert(!ret);
This page took 0.025147 seconds and 4 git commands to generate.