From 4d228aa0129bcafb97d7196d8c18e379b492406d Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 14 Feb 2017 16:36:23 +0100 Subject: virtual: Move mutex into p11_library_init() We used to provide p11_virtual_fixed_{,un}init() to only initialize a mutex used in virtual.c. That required all the tests calling virtual functions to call p11_virtual_fixed_{,un}init() in main(). For simplicity, move the mutex variable initialization into p11_library_init(). --- common/library.c | 3 +++ common/library.h | 3 +++ 2 files changed, 6 insertions(+) (limited to 'common') diff --git a/common/library.c b/common/library.c index 502ea98..39a9c46 100644 --- a/common/library.c +++ b/common/library.c @@ -59,6 +59,8 @@ static p11_local * _p11_library_get_thread_local (void); p11_mutex_t p11_library_mutex; +p11_mutex_t p11_virtual_mutex; + #ifdef OS_UNIX pthread_once_t p11_library_once = PTHREAD_ONCE_INIT; #endif @@ -118,6 +120,7 @@ p11_library_init_impl (void) p11_debug_init (); p11_debug ("initializing library"); p11_mutex_init (&p11_library_mutex); + p11_mutex_init (&p11_virtual_mutex); pthread_key_create (&thread_local, free); p11_message_storage = thread_local_message; diff --git a/common/library.h b/common/library.h index f87494d..c3840f8 100644 --- a/common/library.h +++ b/common/library.h @@ -44,6 +44,9 @@ extern p11_mutex_t p11_library_mutex; +/* Used in virtual.c to maintain the global list of precompiled closures */ +extern p11_mutex_t p11_virtual_mutex; + extern unsigned int p11_forkid; #define p11_lock() p11_mutex_lock (&p11_library_mutex); -- cgit v1.1