summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-12-16 00:12:29 +0100
committerGravatar Nikias Bassen2023-12-16 00:12:29 +0100
commit2ae342bdedffbcd89a0e3607bf8f2e3d2316237a (patch)
treef2b847c9d1973b608e28ff2943e3a4942471cc1c
parent202e8ec125af87c5bfa1d4ee401a42bc37f9d159 (diff)
downloadlibimobiledevice-glue-2ae342bdedffbcd89a0e3607bf8f2e3d2316237a.tar.gz
libimobiledevice-glue-2ae342bdedffbcd89a0e3607bf8f2e3d2316237a.tar.bz2
win32: Fix external compilation using libimobiledevice-glue/thread.h
When using mutex_t data type externally, compilation might fail if CRITICAL_SECTION is not defined, so we just define our own copy.
-rw-r--r--include/libimobiledevice-glue/thread.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/libimobiledevice-glue/thread.h b/include/libimobiledevice-glue/thread.h
index a960410..b9c0bd0 100644
--- a/include/libimobiledevice-glue/thread.h
+++ b/include/libimobiledevice-glue/thread.h
@@ -27,8 +27,21 @@
#ifdef WIN32
typedef void* HANDLE;
typedef HANDLE THREAD_T;
-struct _RTL_CRITICAL_SECTION;
-typedef struct _RTL_CRITICAL_SECTION mutex_t;
+#pragma pack(push, 8)
+struct _CRITICAL_SECTION_ST {
+ void* DebugInfo;
+ long LockCount;
+ long RecursionCount;
+ HANDLE OwningThread;
+ HANDLE LockSemaphore;
+#if defined(_WIN64)
+ unsigned __int64 SpinCount;
+#else
+ unsigned long SpinCount;
+#endif
+};
+#pragma pack(pop)
+typedef struct _CRITICAL_SECTION_ST mutex_t;
typedef struct {
HANDLE sem;
} cond_t;