Re: [PATCH] Do not translate ENOMEM to EAGAIN in pthread_create

Andreas Schwab <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
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, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.