summaryrefslogtreecommitdiffstats
path: root/src/mobile_image_mounter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mobile_image_mounter.c')
-rw-r--r--src/mobile_image_mounter.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mobile_image_mounter.c b/src/mobile_image_mounter.c
index 18caf73..557fbda 100644
--- a/src/mobile_image_mounter.c
+++ b/src/mobile_image_mounter.c
@@ -35,7 +35,11 @@
*/
static void mobile_image_mounter_lock(mobile_image_mounter_client_t client)
{
+#ifdef WIN32
+ EnterCriticalSection(&client->mutex);
+#else
pthread_mutex_lock(&client->mutex);
+#endif
}
/**
@@ -45,7 +49,11 @@ static void mobile_image_mounter_lock(mobile_image_mounter_client_t client)
*/
static void mobile_image_mounter_unlock(mobile_image_mounter_client_t client)
{
+#ifdef WIN32
+ LeaveCriticalSection(&client->mutex);
+#else
pthread_mutex_unlock(&client->mutex);
+#endif
}
/**
@@ -101,7 +109,11 @@ mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, uint16_t
mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private));
client_loc->parent = plistclient;
+#ifdef WIN32
+ InitializeCriticalSection(&client_loc->mutex);
+#else
pthread_mutex_init(&client_loc->mutex, NULL);
+#endif
*client = client_loc;
return MOBILE_IMAGE_MOUNTER_E_SUCCESS;
@@ -123,7 +135,11 @@ mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_clie
property_list_service_client_free(client->parent);
client->parent = NULL;
+#ifdef WIN32
+ DeleteCriticalSection(&client->mutex);
+#else
pthread_mutex_destroy(&client->mutex);
+#endif
free(client);
return MOBILE_IMAGE_MOUNTER_E_SUCCESS;