From 5e9d5cbf1c8e7215dac07d508e0f049d76f96bed Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Mon, 16 Dec 2024 10:12:01 +0100 Subject: [PATCH] win32: don't use pthread on Windows mingw-w64 has winpthread which is detected as available. But on Windows there is custom threading code to use. We should only use one of them. And the win32 API doesn't require an extra -lpthread to link. Fixes #506 --- include/libnfs-multithreading.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/libnfs-multithreading.h b/include/libnfs-multithreading.h index e3caa97b..305ad950 100644 --- a/include/libnfs-multithreading.h +++ b/include/libnfs-multithreading.h @@ -29,7 +29,12 @@ extern "C" { #ifdef HAVE_MULTITHREADING -#ifdef HAVE_PTHREAD +#ifdef WIN32 +typedef HANDLE libnfs_thread_t; +typedef HANDLE libnfs_mutex_t; +typedef HANDLE libnfs_sem_t; +typedef DWORD nfs_tid_t; +#elif defined(HAVE_PTHREAD) #include typedef pthread_t libnfs_thread_t; typedef pthread_mutex_t libnfs_mutex_t; @@ -48,13 +53,6 @@ typedef pid_t nfs_tid_t; #endif #endif /* HAVE_PTHREAD */ -#ifdef WIN32 -typedef HANDLE libnfs_thread_t; -typedef HANDLE libnfs_mutex_t; -typedef HANDLE libnfs_sem_t; -typedef DWORD nfs_tid_t; -#endif - nfs_tid_t nfs_mt_get_tid(void); int nfs_mt_mutex_init(libnfs_mutex_t *mutex); int nfs_mt_mutex_destroy(libnfs_mutex_t *mutex);