summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2017-02-14 16:36:23 +0100
committerDaiki Ueno <ueno@gnu.org>2017-02-14 16:51:58 +0100
commit4d228aa0129bcafb97d7196d8c18e379b492406d (patch)
treebf540be90d036a542070a8dc91c5cd533e9e600d /common
parent1ea08989cecee217befd3b964b5a4f0d584e2a29 (diff)
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().
Diffstat (limited to 'common')
-rw-r--r--common/library.c3
-rw-r--r--common/library.h3
2 files changed, 6 insertions, 0 deletions
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);