[PATCH] Do not translate ENOMEM to EAGAIN in pthread_create
Andreas Schwab
schwab@suse.de
Wed Jul 8 11:27:03 GMT 2026
On Jul 08 2026, Florian Weimer wrote:
> diff --git a/manual/threads.texi b/manual/threads.texi
> index 0331599bc0..2f43f7f917 100644
> --- a/manual/threads.texi
> +++ b/manual/threads.texi
> @@ -593,7 +593,27 @@ This function creates a new thread with attributes @var{attr}. This
> thread will call @var{start_routine} and pass it @var{arg}. If
> @var{start_routine} returns, the thread will exit and the return value
> will become the thread's exit value. The new thread's ID is stored in
> -@var{newthread}. Returns 0 on success.
> +@var{newthread}. Returns 0 on success, and an error code on failure.
> +Among the failure codes are:
> +
> +@table @code
> +@item EAGAIN
> +The thread could not be created because the maximum thread count for the
> +process, user, or system has been reached. On Linux, this error can be
> +spurious, and calling @code{pthread_create} again may succeed although
> +no threads have exited since the previous call.
Perhaps s/although/even if/.
> +@item ENOMEM
> +Memory for the new thread could not be allocated. This can refer to
> +memory for the stack, thread-local storage, or administrative data.
> +
> +POSIX suggests reporting these error conditions as @code{EAGAIN},
I don't think it is a suggestion, but a shall.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
More information about the Libc-alpha
mailing list