svn commit: r201669 - head/lib/libc/stdtime

John Baldwin jhb at FreeBSD.org
Wed Jan 6 20:43:40 UTC 2010


Author: jhb
Date: Wed Jan  6 20:43:40 2010
New Revision: 201669
URL: http://svn.freebsd.org/changeset/base/201669

Log:
  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

Modified:
  head/lib/libc/stdtime/localtime.c

Modified: head/lib/libc/stdtime/localtime.c
==============================================================================
--- head/lib/libc/stdtime/localtime.c	Wed Jan  6 20:41:12 2010	(r201668)
+++ head/lib/libc/stdtime/localtime.c	Wed Jan  6 20:43:40 2010	(r201669)
@@ -1426,7 +1426,7 @@ const time_t * const	timep;
 	struct tm *p_tm;
 
 	if (__isthreaded != 0) {
-		_once(&localtime_once, localtime_key_init);
+		_pthread_once(&localtime_once, localtime_key_init);
 		if (localtime_key_error != 0) {
 			errno = localtime_key_error;
 			return(NULL);
@@ -1527,7 +1527,7 @@ const time_t * const	timep;
 	struct tm *p_tm;
 
 	if (__isthreaded != 0) {
-		_once(&gmtime_once, gmtime_key_init);
+		_pthread_once(&gmtime_once, gmtime_key_init);
 		if (gmtime_key_error != 0) {
 			errno = gmtime_key_error;
 			return(NULL);


More information about the svn-src-all mailing list