aboutsummaryrefslogtreecommitdiffstats
path: root/src/ath.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ath.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ath.c b/src/ath.c
index dda7c318..afc5530e 100644
--- a/src/ath.c
+++ b/src/ath.c
@@ -42,6 +42,33 @@
#define MUTEX_DESTROYED ((ath_mutex_t) 2)
+#ifdef HAVE_W32_SYSTEM
+#include <windows.h>
+uintptr_t
+ath_self (void)
+{
+ return (uintptr_t) GetCurrentThreadID ();
+}
+#else
+# ifdef __linux
+#include <sys/types.h>
+#include <sys/syscall.h>
+uintptr_t
+ath_self (void)
+{
+ /* Just to catch users who don't use gpgme-pthread. */
+ return (uintptr_t) syscall (SYS_gettid);
+}
+# else
+uintptr_t
+ath_self (void)
+{
+ return (uintptr_t) getpid ();
+}
+# endif
+#endif
+
+
int
ath_mutex_init (ath_mutex_t *lock)
{