This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Does localtime_r(...) use pthread library (LinuxThreads or NPTL)?
- From: "Bo Xie" <xiebopublic at gmail dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 15 Aug 2006 18:55:20 +0800
- Subject: Does localtime_r(...) use pthread library (LinuxThreads or NPTL)?
Hi all,
Does localtime_r(...) use pthread library (LinuxThreads or NPTL)?
I've checked glibc 2.4 source code. But I don't know what "weak_alias
(__localtime_r, localtime_r)" means. I really want to know how to
implement thread-safe glibc.
------localtime.c---
#include <time.h>
/* The C Standard says that localtime and gmtime return the same pointer. */
struct tm _tmbuf;
/* Return the `struct tm' representation of *T in local time,
using *TP to store the result. */
struct tm *
__localtime_r (t, tp)
const time_t *t;
struct tm *tp;
{
return __tz_convert (t, 1, tp);
}
weak_alias (__localtime_r, localtime_r)
/* Return the `struct tm' representation of *T in local time. */
struct tm *
localtime (t)
const time_t *t;
{
return __tz_convert (t, 1, &_tmbuf);
}
libc_hidden_def (localtime)
-----------------------
Thanks!
Best Regards,
Xie, Bo