diff mbox series

always check pthread_create for failures

Message ID 20221002161343.854582-1-normalperson@yhbt.net
State New
Headers show
Series always check pthread_create for failures | expand

Commit Message

Eric Wong Oct. 2, 2022, 4:13 p.m. UTC
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(-)

Comments

Mathieu Desnoyers Oct. 3, 2022, 2:41 p.m. UTC | #1
On 2022-10-02 12:13, Eric Wong via lttng-dev wrote:
> pthread_create may fail with EAGAIN (which is no fault of the
> programmer), so don't allow the check to be compiled out.

Merged into master, stable-0.13, stable-0.12, thanks!

Mathieu

> 
> 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);
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
diff mbox series

Patch

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);