This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix locking issue in newlocale


On Fri, Jul 16, 2004 at 02:16:39PM +0200, Jakub Jelinek wrote:
>   for (i = 0; i < 100000; ++i)
>     setlocale (LC_ALL, locales[(i % 27) & 1]);
> ...
>   for (i = 0; i < 10; ++i)
>     pthread_create (&p[i], NULL, i % 2 ? tf : tf2, NULL);

I'm not sure that we should expect this to be safe anyhow.
Since setlocale is visibly modifying global state, it seems that
the user should be responsible for controlling access to it.
Certainly, if there is any contention, neither thread could count
on getting the result it expected.  

Nathan Myers
ncm@cantrip.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]