Use _pthread_once() rather than _once() for localtime() and gmtime(). These

methods are only invoked when __isthreaded is true at which point it is safe
to use _pthread_once() directly.

MFC after:	1 week
This commit is contained in:
John Baldwin 2010-01-06 20:43:40 +00:00
parent 2cf8fb9be3
commit 8feb1ea45e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=201669

View File

@ -1426,7 +1426,7 @@ const time_t * const timep;
struct tm *p_tm; struct tm *p_tm;
if (__isthreaded != 0) { if (__isthreaded != 0) {
_once(&localtime_once, localtime_key_init); _pthread_once(&localtime_once, localtime_key_init);
if (localtime_key_error != 0) { if (localtime_key_error != 0) {
errno = localtime_key_error; errno = localtime_key_error;
return(NULL); return(NULL);
@ -1527,7 +1527,7 @@ const time_t * const timep;
struct tm *p_tm; struct tm *p_tm;
if (__isthreaded != 0) { if (__isthreaded != 0) {
_once(&gmtime_once, gmtime_key_init); _pthread_once(&gmtime_once, gmtime_key_init);
if (gmtime_key_error != 0) { if (gmtime_key_error != 0) {
errno = gmtime_key_error; errno = gmtime_key_error;
return(NULL); return(NULL);