summaryrefslogtreecommitdiff
path: root/p11-kit
diff options
context:
space:
mode:
Diffstat (limited to 'p11-kit')
-rw-r--r--p11-kit/modules.c6
-rw-r--r--p11-kit/util.h11
2 files changed, 11 insertions, 6 deletions
diff --git a/p11-kit/modules.c b/p11-kit/modules.c
index f965b5c..547ee02 100644
--- a/p11-kit/modules.c
+++ b/p11-kit/modules.c
@@ -109,7 +109,7 @@ typedef struct _Module {
/* Initialization, mutex must be held */
mutex_t initialize_mutex;
int initialize_called;
- thread_t initialize_thread;
+ thread_id_t initialize_thread;
} Module;
/*
@@ -531,10 +531,10 @@ static CK_RV
initialize_module_unlocked_reentrant (Module *mod)
{
CK_RV rv = CKR_OK;
- thread_t self;
+ thread_id_t self;
assert (mod);
- self = _p11_thread_self ();
+ self = _p11_thread_id_self ();
if (mod->initialize_thread == self) {
_p11_message ("p11-kit initialization called recursively");
diff --git a/p11-kit/util.h b/p11-kit/util.h
index 2da4db6..b8d4a15 100644
--- a/p11-kit/util.h
+++ b/p11-kit/util.h
@@ -65,6 +65,8 @@ typedef CRITICAL_SECTION mutex_t;
typedef HANDLE thread_t;
+typedef DWORD thread_id_t;
+
#define _p11_mutex_init(m) \
(InitializeCriticalSection (m))
#define _p11_mutex_lock(m) \
@@ -80,8 +82,9 @@ int _p11_thread_create (thread_t *thread, thread_routine, void *arg);
int _p11_thread_join (thread_t thread);
-#define _p11_thread_self() \
- (GetCurrentThread ())
+/* Returns a thread_id_t */
+#define _p11_thread_id_self() \
+ (GetCurrentThreadId ())
typedef HMODULE dl_module_t;
@@ -122,13 +125,15 @@ void _p11_mutex_init (mutex_t *mutex);
typedef pthread_t thread_t;
+typedef pthread_t thread_id_t;
+
typedef void * (*thread_routine) (void *arg);
#define _p11_thread_create(t, r, a) \
(pthread_create ((t), NULL, (r), (a)))
#define _p11_thread_join(t) \
(pthread_join ((t), NULL))
-#define _p11_thread_self(m) \
+#define _p11_thread_id_self(m) \
(pthread_self ())
typedef void * dl_module_t;