[lttng-dev] [PATCH] always check pthread_create for failures

Eric Wong normalperson at yhbt.net
Sun Oct 2 12:13:43 EDT 2022


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 at yhbt.net>
---
 src/urcu-defer-impl.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/urcu-defer-impl.h b/src/urcu-defer-impl.h
index 1c96287..cbb0ca8 100644
--- a/src/urcu-defer-impl.h
+++ b/src/urcu-defer-impl.h
@@ -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);


More information about the lttng-dev mailing list