stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Farid_Zari...@epam.com>
Subject RE: [PATCH] __rw_setlocale not threadsafe
Date Mon, 01 Oct 2007 14:39:09 GMT
> -----Original Message-----
> From: Travis Vitek [mailto:tvitek@quovadx.com] 
> Sent: Saturday, September 29, 2007 2:27 AM
> To: stdcxx-dev@incubator.apache.org
> Subject: [PATCH] __rw_setlocale not threadsafe
> 
> 
> The __rw_setlocale destructor currently restores the previous 
> locale when it isn't holding the lock. This can cause 
> problems if another thread takes the lock and calls setlocale 
> before the original thread restores the locale.
> 
> I believe this problem to be the cause of the following 
> failure that I frequently get when running the 
> 22.locale.numpunct.mt test.
> 
>     terminate called after throwing an instance of 
> 'std::runtime_error'
>       what():  
> /amd/devco/vitek/stdcxx-trunk/src/setlocale.cpp:128: 
> __rw::__rw_setlocale::__rw_setlocale(const char *, int, int): 
> bad locale name: "À¡G.utf8"
>     Aborted (core dumped)
> 
> Note: The only time that the destructor needs to restore the 
> locale is when the locale was actually changed. That case is 
> indicated when _C_guard is set to some non-zero value.

  Commited thus: http://svn.apache.org/viewvc?rev=580961&view=rev

Farid.

Mime
View raw message