Web lists-archives.org

Re: [Mingw-users] Porting localtime_r and gmtime_r




Tor Lillqvist wrote:
>>  http://msdn2.microsoft.com/en-us/library/aa246456(VS.60).aspx
> 
>>   > gmtime, mktime, and localtime all use a single statically allocated tm
>>   > structure for the conversion. Each call to one of these routines
>>   > destroys the result of the previous call.
> 
> That is misleading. Even in the C runtime sources included with the
> venerable MSVC6, gmtime uses thread-local storage for their buffer in
> the multithreaded versions of the C runtime (i.e., including
> msvcrt.dll). (localtime calls gmtime, and mktime calls gmtime and
> localtime, they don't use any static or thread-local buffer of their
> own as far as I could see.)
> 
> I would be surprised if this had been changed in some later version of
> msvcrt.dll, or one of the other runtimes like msvcr80.dll. Certainly
> in the C runtime sources included with MSVS8 and the Platform SDK "for
> Windows Server 2003 R2" gmtime still uses thread-local storage.
> 
> --tml
> 

OK, that would mean gmtime and localtime in msvcrt.dll which mingw links 
to is thread safe.

I'm a bit confused about thread-local buffer. What is the difference 
between thread-local storage and thread-local buffer?

Thanks.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users