[PATCH] Fix locking issue in newlocale
Nathan Myers
ncm-nospam@cantrip.org
Fri Jul 16 16:43:00 GMT 2004
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
More information about the Libstdc++
mailing list