Re: localtime() thread-safe or not?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"MarkMark" <MarkMark@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>localtime() C Runtime API is documented 
>(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_localtime.asp) 
>to return result in static memory, which, of course is not thread safe.
>
>However, indirect evidence 
>(http://support.microsoft.com/default.aspx?scid=kb;en-us;104641) appears to 
>suggest that localtime() actually uses Thread Local Store which makes it 
>thread safe.
>
>So my question is -- is localtime() really thread safe or not?

You got several good answers to your question, but the RIGHT answer is "Use
the source, Luke".  The source for Microsoft's C runtime library is
included with the compiler.  You can look this up yourself.
-- 
- Tim Roberts, timr@xxxxxxxxx
  Providenza & Boekelheide, Inc.
.



Relevant Pages

  • Re: localtime() thread-safe or not?
    ... > appears to suggest that localtime() actually uses Thread ... > Local Store which makes it thread safe. ... It depends on your definition of thread safety. ... sinchronization, too, then CRT functions will not guarantee ...
    (microsoft.public.vc.language)
  • Re: localtime() thread-safe or not?
    ... to return result in static memory, which, of course is not thread safe. ... indirect evidence appears to suggest that localtimeactually uses Thread Local Store which makes it thread safe. ... So my question is -- is localtime() really thread safe or not? ...
    (microsoft.public.vc.language)
  • localtime in Solaris 9 is not thread safe?
    ... I'm using pthreadprogramming in Solaris 9 and find that localtime is ... not thread safe. ... Franklin ...
    (comp.unix.solaris)