summaryrefslogtreecommitdiffstats
path: root/src/mobile_image_mounter.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2011-09-10 19:08:39 +0200
committerGravatar Martin Szulecki2012-03-19 01:38:54 +0100
commit475c9679716eec92e3508063b7486e3508c4c974 (patch)
tree5ab09c85387821e05b052cbb642b92ae102953ec /src/mobile_image_mounter.c
parent6f29ab73053327066409744d025dcbd03fd6b627 (diff)
downloadlibimobiledevice-475c9679716eec92e3508063b7486e3508c4c974.tar.gz
libimobiledevice-475c9679716eec92e3508063b7486e3508c4c974.tar.bz2
WIN32: use windows threads and mutexes instead of pthread_*
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;