Subj : Re: localtime in Solaris 9 is not thread safe? To : comp.programming.threads From : Dragan Cvetkovic Date : Tue Mar 08 2005 08:52 am Thomas Mueller writes: > On Tue, 08 Mar 2005 13:36:26 +0800, Franklin Li wrote: > >> >> I'm doing pthread(C++) programming in Solaris 9 and find that localtime is >> not thread safe. Is it true? >> >> [...pstack dump snipped...] >> >> Is there solution for this? >> > > Since localtime() is not reentrant it may well be that it is not > thread-safe. Try using localtime_r() instead. Man page for localtime(3C) on Solaris 10 has the following information in it: The asctime(), ctime(), gmtime(), and localtime() functions are safe to use in multithread applications because they employ thread-specific data. However, their use is discouraged because standards do not require them to be thread-safe. However, the corresponding man page on Solaris 9 says explicitly: The asctime(), ctime(), gmtime(), and localtime() functions are unsafe in multithread applications. The asctime_r() and gmtime_r() functions are MT-Safe. So, upgrade to Solaris 10 :-) Dragan -- Dragan Cvetkovic, To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer !!! Sender/From address is bogus. Use reply-to one !!! .