diff options
| author | 2011-09-03 02:07:09 +0200 | |
|---|---|---|
| committer | 2012-03-18 20:40:54 +0100 | |
| commit | 6a83ef58a1032e3b336587e2f3a19659ae325c25 (patch) | |
| tree | 27e12297bc66bd22a0cfc86459413a49a0d998f2 /src/mobile_image_mounter.c | |
| parent | b586203dbef26f9e94325b57867478eda504e5a1 (diff) | |
| download | libimobiledevice-6a83ef58a1032e3b336587e2f3a19659ae325c25.tar.gz libimobiledevice-6a83ef58a1032e3b336587e2f3a19659ae325c25.tar.bz2 | |
Remove gthread dependency and use pthreads instead
Diffstat (limited to 'src/mobile_image_mounter.c')
| -rw-r--r-- | src/mobile_image_mounter.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/mobile_image_mounter.c b/src/mobile_image_mounter.c index 367bee0..18caf73 100644 --- a/src/mobile_image_mounter.c +++ b/src/mobile_image_mounter.c | |||
| @@ -35,7 +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 | g_mutex_lock(client->mutex); | 38 | pthread_mutex_lock(&client->mutex); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | /** | 41 | /** |
| @@ -45,7 +45,7 @@ static void mobile_image_mounter_lock(mobile_image_mounter_client_t client) | |||
| 45 | */ | 45 | */ |
| 46 | 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) |
| 47 | { | 47 | { |
| 48 | g_mutex_unlock(client->mutex); | 48 | pthread_mutex_unlock(&client->mutex); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| @@ -90,10 +90,6 @@ static mobile_image_mounter_error_t mobile_image_mounter_error(property_list_ser | |||
| 90 | */ | 90 | */ |
| 91 | mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, uint16_t port, mobile_image_mounter_client_t *client) | 91 | mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, uint16_t port, mobile_image_mounter_client_t *client) |
| 92 | { | 92 | { |
| 93 | /* makes sure thread environment is available */ | ||
| 94 | if (!g_thread_supported()) | ||
| 95 | g_thread_init(NULL); | ||
| 96 | |||
| 97 | if (!device) | 93 | if (!device) |
| 98 | return MOBILE_IMAGE_MOUNTER_E_INVALID_ARG; | 94 | return MOBILE_IMAGE_MOUNTER_E_INVALID_ARG; |
| 99 | 95 | ||
| @@ -105,7 +101,7 @@ mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, uint16_t | |||
| 105 | mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private)); | 101 | mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private)); |
| 106 | client_loc->parent = plistclient; | 102 | client_loc->parent = plistclient; |
| 107 | 103 | ||
| 108 | client_loc->mutex = g_mutex_new(); | 104 | pthread_mutex_init(&client_loc->mutex, NULL); |
| 109 | 105 | ||
| 110 | *client = client_loc; | 106 | *client = client_loc; |
| 111 | return MOBILE_IMAGE_MOUNTER_E_SUCCESS; | 107 | return MOBILE_IMAGE_MOUNTER_E_SUCCESS; |
| @@ -127,9 +123,7 @@ mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_clie | |||
| 127 | 123 | ||
| 128 | property_list_service_client_free(client->parent); | 124 | property_list_service_client_free(client->parent); |
| 129 | client->parent = NULL; | 125 | client->parent = NULL; |
| 130 | if (client->mutex) { | 126 | pthread_mutex_destroy(&client->mutex); |
| 131 | g_mutex_free(client->mutex); | ||
| 132 | } | ||
| 133 | free(client); | 127 | free(client); |
| 134 | 128 | ||
| 135 | return MOBILE_IMAGE_MOUNTER_E_SUCCESS; | 129 | return MOBILE_IMAGE_MOUNTER_E_SUCCESS; |
