diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-02-15 23:05:03 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-02-15 23:05:03 +0000 |
commit | 70ea4e132359aaa66ab3c49f65cd52862e567a25 (patch) | |
tree | 4667ae22d4df766567efd53444eaef98d821d6c9 /lib/libthr/thread/thr_once.c | |
parent | ad011f6a36d4d13210e325ce8c3e5930c94dff78 (diff) | |
download | FreeBSD-src-70ea4e132359aaa66ab3c49f65cd52862e567a25.zip FreeBSD-src-70ea4e132359aaa66ab3c49f65cd52862e567a25.tar.gz |
Rework last change of pthread_once, create a function _thr_once_init to
reinitialize its internal locks.
Diffstat (limited to 'lib/libthr/thread/thr_once.c')
-rw-r--r-- | lib/libthr/thread/thr_once.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_once.c b/lib/libthr/thread/thr_once.c index 98360f2..4fe392c 100644 --- a/lib/libthr/thread/thr_once.c +++ b/lib/libthr/thread/thr_once.c @@ -40,8 +40,8 @@ __weak_reference(_pthread_once, pthread_once); #define ONCE_IN_PROGRESS 0x02 #define ONCE_MASK 0x03 -pthread_mutex_t _thr_once_lock = PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t _thr_once_cv = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t _thr_once_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t _thr_once_cv = PTHREAD_COND_INITIALIZER; /* * POSIX: @@ -91,3 +91,9 @@ _pthread_once(pthread_once_t *once_control, void (*init_routine) (void)) return (0); } +void +_thr_once_init() +{ + _thr_once_lock = PTHREAD_MUTEX_INITIALIZER; + _thr_once_cv = PTHREAD_COND_INITIALIZER; +} |