This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 20/28] Thread safety documentation.
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 16 Aug 2013 05:35:15 -0300
- Subject: [PATCH 20/28] Thread safety documentation.
- References: <20130816081210 dot 22991 dot 30766 dot stgit at frit dot home>
for ChangeLog
* manual/locale.texi: Document thread safety properties.
---
manual/locale.texi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/manual/locale.texi b/manual/locale.texi
index 2f10fcd..60e08d8 100644
--- a/manual/locale.texi
+++ b/manual/locale.texi
@@ -224,6 +224,16 @@ The symbols in this section are defined in the header file @file{locale.h}.
@comment locale.h
@comment ISO
@deftypefun {char *} setlocale (int @var{category}, const char *@var{locale})
+@safety{@mtunsafe{uunguard, envromt}@asunsafe{selfdeadlock, asmalloc}@acunsafe{lockleak, memleak}}
+@c Uses of the global locale object are unguarded in functions that
+@c ought to be MT-Safe, so we're ruling out the use of this function
+@c once threads are started. It takes a write lock itself, but it may
+@c return a pointer loaded from the global locale object after releasing
+@c the lock, or before taking it. It calls getenv for LOCPATH, malloc
+@c and free, and _nl_find_locale, which amount to all documented safety
+@c issues. It also calls new_composite_name, setdata, and setname,
+@c without any additional issues. _nl_find_locale calls getenv, ...
+@c This function returns a pointer read...
The function @code{setlocale} sets the current locale for category
@var{category} to @var{locale}. A list of all the locales the system
provides can be created by running