commit 953942677b185da6bf5a66adbf968446dd901841
parent 4fc783ecbd230c5c8e8ed0de1818b252070ef979
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sun, 27 Aug 2017 20:48:15 +0300
mhd_threads: added MHD_thread_ID_match_current_()
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h
@@ -123,6 +123,22 @@
#define MHD_join_thread_(thread) (WAIT_OBJECT_0 == WaitForSingleObject((thread), INFINITE) ? (CloseHandle((thread)), !0) : 0)
#endif
+#if defined(MHD_USE_POSIX_THREADS)
+/**
+ * Check whether provided thread ID match current thread.
+ * @param ID thread ID to match
+ * @return nonzero on match, zero otherwise
+ */
+#define MHD_thread_ID_match_current_(ID) (pthread_equal((ID), pthread_self()))
+#elif defined(MHD_USE_W32_THREADS)
+/**
+ * Check whether provided thread ID match current thread.
+ * @param ID thread ID to match
+ * @return nonzero on match, zero otherwise
+ */
+#define MHD_thread_ID_match_current_(ID) (GetCurrentThreadId() == (ID))
+#endif
+
/**
* Signature of main function for a thread.
*