Rework last change of pthread_once, create a function _thr_once_init to
reinitialize its internal locks.
This commit is contained in:
parent
224409590d
commit
6f716c2f82
@ -412,8 +412,7 @@ init_private(void)
|
||||
_thr_umtx_init(&_keytable_lock);
|
||||
_thr_umtx_init(&_thr_atfork_lock);
|
||||
_thr_umtx_init(&_thr_event_lock);
|
||||
_thr_once_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
_thr_once_cv = PTHREAD_COND_INITIALIZER;
|
||||
_thr_once_init();
|
||||
_thr_spinlock_init();
|
||||
_thr_list_init();
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -649,8 +649,6 @@ extern umtx_t _rwlock_static_lock __hidden;
|
||||
extern umtx_t _keytable_lock __hidden;
|
||||
extern umtx_t _thr_list_lock __hidden;
|
||||
extern umtx_t _thr_event_lock __hidden;
|
||||
extern pthread_mutex_t _thr_once_lock __hidden;
|
||||
extern pthread_cond_t _thr_once_cv __hidden;
|
||||
|
||||
/*
|
||||
* Function prototype definitions.
|
||||
@ -727,6 +725,7 @@ void _thr_suspend_check(struct pthread *) __hidden;
|
||||
void _thr_assert_lock_level(void) __hidden __dead2;
|
||||
void _thr_ast(struct pthread *) __hidden;
|
||||
void _thr_timer_init(void) __hidden;
|
||||
void _thr_once_init(void) __hidden;
|
||||
void _thr_report_creation(struct pthread *curthread,
|
||||
struct pthread *newthread) __hidden;
|
||||
void _thr_report_death(struct pthread *curthread) __hidden;
|
||||
|
Loading…
x
Reference in New Issue
Block a user