bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

POSIX gettext(): multithread-safe or not?


From: Bruno Haible
Subject: POSIX gettext(): multithread-safe or not?
Date: Thu, 12 May 2022 01:28:03 +0200

https://posix.rhansen.org/p/gettext_draft
Line 357

"The returned string shall not be ... invalidated by a subsequent call
 to a gettext family function."

It is not clear whether this sentence is an assertion (regarding how the
gettext() implementation behaves) or a requirement/restriction w.r.t. the
application.

In the latter case, the consequences of this restriction would be:
  1) Multithreaded applications cannot use gettext, except during
     initialization when only one thread exists.
  2) Libraries cannot use gettext, otherwise multithreaded applications
     cannot make use of them. And *many* applications are multithreaded
     nowadays.

If the gettext() functions are designed like this, they would be as
problematic to use as the the old non-reentrant, non-MT-safe functions
(like getpwnam), for which _r variants had to be designed.

We don't want to replace all calls to gettext() with calls to gettext_r()!






reply via email to

[Prev in Thread] Current Thread [Next in Thread]