Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jan 2010 20:43:40 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r201669 - head/lib/libc/stdtime
Message-ID:  <201001062043.o06KhebK034288@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001062043.o06KhebK034288>