summaryrefslogtreecommitdiff
path: root/p11-kit/util.h
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2012-07-17 08:06:28 +0200
committerStef Walter <stefw@gnome.org>2012-07-26 12:22:31 +0200
commit06595e93ff57e97adbb313aebc50a2e32acd6039 (patch)
tree01b3af353a23c55b0f7f8947e17145b0a72996af /p11-kit/util.h
parent356377709cd1de1308d9d8cf15f528578a360cf3 (diff)
Use Windows thread ids instead of handles for comparisons
* It seems that the HANDLE's returned from GetCurrentThread are often equal for two threads. GetCurrentThreadID doesn't have this problem. * Separate our cross platform thread_t and thread_id_t types even though on unix they're the same thing. https://bugzilla.gnome.org/show_bug.cgi?id=44740
Diffstat (limited to 'p11-kit/util.h')
-rw-r--r--p11-kit/util.h11
1 files changed, 8 insertions, 3 deletions
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;