linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] strtod.3: ATTRIBUTES: Note functions that are thread safe with exceptions
@ 2014-01-20  8:15 Peng Haitao
       [not found] ` <1390205712-10266-1-git-send-email-penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Peng Haitao @ 2014-01-20  8:15 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: carlos-v2tUB8YBRSi3e3T8WW9gsA, aoliva-H+wXaHxf7aLQT0dZR+AlfA,
	linux-man-u79uwXL29TY76Z2rM5mHXA

The functions strtod(), strtof() and strtold() are thread safe
with exceptions.

Signed-off-by: Peng Haitao <penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
---
 man3/strtod.3 | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/man3/strtod.3 b/man3/strtod.3
index 8498a06..43efb50 100644
--- a/man3/strtod.3
+++ b/man3/strtod.3
@@ -42,7 +42,7 @@
 .\"   (michael-dcCOIfDdh9paP0f+8Gpiu5H8eBQqjErGxu+e+x4sQ7A@public.gmane.org)
 .\" Added strof, strtold, aeb, 2001-06-07
 .\"
-.TH STRTOD 3 2010-09-20 "Linux" "Linux Programmer's Manual"
+.TH STRTOD 3 2014-01-20 "Linux" "Linux Programmer's Manual"
 .SH NAME
 strtod, strtof, strtold \- convert ASCII string to floating-point number
 .SH SYNOPSIS
@@ -157,6 +157,18 @@ is stored in
 .TP
 .B ERANGE
 Overflow or underflow occurred.
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR strtod (),
+.BR strtof (),
+and
+.BR strtold ()
+functions are thread-safe with exceptions.
+These functions can be safely used in multithreaded applications,
+as long as
+.BR setlocale (3)
+is not called to change the locale.
 .SH CONFORMING TO
 C89 describes
 .BR strtod (),
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* Re: [PATCH] strtod.3: ATTRIBUTES: Note functions that are thread safe with exceptions
@ 2014-01-22 10:41 Michael Kerrisk (man-pages)
       [not found] ` <CAKgNAkhCPtc4edgFhmc+3m+j_8AxucNzG4TY79sSuK2Cq8kreA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Kerrisk (man-pages) @ 2014-01-22 10:41 UTC (permalink / raw)
  To: Peng Haitao
  Cc: Andre Majorel, Carlos O'Donell, aoliva-H+wXaHxf7aLQT0dZR+AlfA,
	linux-man

Hello Haitao,

On Wed, Jan 22, 2014 at 9:57 AM, Peng Haitao <penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> wrote:
>
> On 01/22/2014 04:29 PM, Andre Majorel wrote:
>>>> If that is the case, how about :
>>>>
>>>>   These functions can be safely used in multithreaded
>>>>   applications, as long as the locale is not changed during
>>>>   their execution.
>>>
>>> The above sentence is OK, but I think added setlocale(3) is
>>> better, thanks.
>>>
>>> These functions can be safely used in multithreaded
>>> applications, as long as setlocale(3) is not called
>>> to change the locale during their execution.
>>
>> This wording can be interpreted to mean that calling setlocale()
>> *is* permitted as long as the locale doesn't change. If that is
>> really what you mean, then no further objections from me.
>
> That is what I mean.

Can I just confirm what I understand from this conversation:

* A call to strtod() is thread-safe so long as no other thread uses
setlocale() to change the locale *during* the execution of strtod().
* If a call to setlocale() changes the locale *before* a call to
strtod(), then the call to strtod() is still thread safe.

Correct?

Thanks,

Michael


> --
> Best Regards,
> Peng
>
>> Otherwise, my recommendation would be
>>
>>   These functions can be safely used in multithreaded
>>   applications, as long as setlocale() is not called during
>>   their execution.
>>
>



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-01-23  0:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-20  8:15 [PATCH] strtod.3: ATTRIBUTES: Note functions that are thread safe with exceptions Peng Haitao
     [not found] ` <1390205712-10266-1-git-send-email-penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2014-01-20 12:23   ` Michael Kerrisk (man-pages)
2014-01-20 12:28   ` Andre Majorel
     [not found]     ` <20140120122841.GC29966-956IwFboN44acnK+F/IuxqxOck334EZe@public.gmane.org>
2014-01-21  3:08       ` Peng Haitao
     [not found]         ` <52DDE4A6.5070405-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2014-01-21  6:19           ` Michael Kerrisk (man-pages)
     [not found]             ` <52DE1182.2030704-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-21  6:38               ` Peng Haitao
     [not found]                 ` <52DE15E2.2080607-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2014-01-21 13:52                   ` Andre Majorel
     [not found]                     ` <20140121135244.GD29966-956IwFboN44acnK+F/IuxqxOck334EZe@public.gmane.org>
2014-01-22  2:15                       ` Peng Haitao
     [not found]                         ` <52DF29C0.7080404-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2014-01-22  8:29                           ` Andre Majorel
     [not found]                             ` <20140122082903.GE29966-956IwFboN44acnK+F/IuxqxOck334EZe@public.gmane.org>
2014-01-22  8:57                               ` Peng Haitao
  -- strict thread matches above, loose matches on Subject: below --
2014-01-22 10:41 Michael Kerrisk (man-pages)
     [not found] ` <CAKgNAkhCPtc4edgFhmc+3m+j_8AxucNzG4TY79sSuK2Cq8kreA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-23  0:07   ` Peng Haitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).