diff options
| author | 2013-03-20 05:38:06 +0100 | |
|---|---|---|
| committer | 2013-03-20 05:38:06 +0100 | |
| commit | b2924a1549d874fb86deaad5fd2438e567c65bf4 (patch) | |
| tree | ead89f885a0492cdfc228a1c25326912e7d9b973 /src/mobile_image_mounter.c | |
| parent | efca491e4c19868a68a099638552f9ba431dca4b (diff) | |
| download | libimobiledevice-b2924a1549d874fb86deaad5fd2438e567c65bf4.tar.gz libimobiledevice-b2924a1549d874fb86deaad5fd2438e567c65bf4.tar.bz2 | |
use new internal common code for thread, mutex, and socket operations
Diffstat (limited to 'src/mobile_image_mounter.c')
| -rw-r--r-- | src/mobile_image_mounter.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/mobile_image_mounter.c b/src/mobile_image_mounter.c index 1d608db..209e367 100644 --- a/src/mobile_image_mounter.c +++ b/src/mobile_image_mounter.c | |||
| @@ -35,11 +35,7 @@ | |||
| 35 | */ | 35 | */ |
| 36 | static void mobile_image_mounter_lock(mobile_image_mounter_client_t client) | 36 | static void mobile_image_mounter_lock(mobile_image_mounter_client_t client) |
| 37 | { | 37 | { |
| 38 | #ifdef WIN32 | 38 | mutex_lock(&client->mutex); |
| 39 | EnterCriticalSection(&client->mutex); | ||
| 40 | #else | ||
| 41 | pthread_mutex_lock(&client->mutex); | ||
| 42 | #endif | ||
| 43 | } | 39 | } |
| 44 | 40 | ||
| 45 | /** | 41 | /** |
| @@ -49,11 +45,7 @@ static void mobile_image_mounter_lock(mobile_image_mounter_client_t client) | |||
| 49 | */ | 45 | */ |
| 50 | static void mobile_image_mounter_unlock(mobile_image_mounter_client_t client) | 46 | static void mobile_image_mounter_unlock(mobile_image_mounter_client_t client) |
| 51 | { | 47 | { |
| 52 | #ifdef WIN32 | 48 | mutex_unlock(&client->mutex); |
| 53 | LeaveCriticalSection(&client->mutex); | ||
| 54 | #else | ||
| 55 | pthread_mutex_unlock(&client->mutex); | ||
| 56 | #endif | ||
| 57 | } | 49 | } |
| 58 | 50 | ||
| 59 | /** | 51 | /** |
| @@ -107,11 +99,7 @@ mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdown | |||
| 107 | mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private)); | 99 | mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private)); |
| 108 | client_loc->parent = plistclient; | 100 | client_loc->parent = plistclient; |
| 109 | 101 | ||
| 110 | #ifdef WIN32 | 102 | mutex_init(&client_loc->mutex); |
| 111 | InitializeCriticalSection(&client_loc->mutex); | ||
| 112 | #else | ||
| 113 | pthread_mutex_init(&client_loc->mutex, NULL); | ||
| 114 | #endif | ||
| 115 | 103 | ||
| 116 | *client = client_loc; | 104 | *client = client_loc; |
| 117 | return MOBILE_IMAGE_MOUNTER_E_SUCCESS; | 105 | return MOBILE_IMAGE_MOUNTER_E_SUCCESS; |
| @@ -133,11 +121,7 @@ mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_clie | |||
| 133 | 121 | ||
| 134 | property_list_service_client_free(client->parent); | 122 | property_list_service_client_free(client->parent); |
| 135 | client->parent = NULL; | 123 | client->parent = NULL; |
| 136 | #ifdef WIN32 | 124 | mutex_destroy(&client->mutex); |
| 137 | DeleteCriticalSection(&client->mutex); | ||
| 138 | #else | ||
| 139 | pthread_mutex_destroy(&client->mutex); | ||
| 140 | #endif | ||
| 141 | free(client); | 125 | free(client); |
| 142 | 126 | ||
| 143 | return MOBILE_IMAGE_MOUNTER_E_SUCCESS; | 127 | return MOBILE_IMAGE_MOUNTER_E_SUCCESS; |
