diff options
| author | 2011-09-03 02:07:09 +0200 | |
|---|---|---|
| committer | 2012-03-18 20:40:54 +0100 | |
| commit | 6a83ef58a1032e3b336587e2f3a19659ae325c25 (patch) | |
| tree | 27e12297bc66bd22a0cfc86459413a49a0d998f2 /src/sbservices.c | |
| parent | b586203dbef26f9e94325b57867478eda504e5a1 (diff) | |
| download | libimobiledevice-6a83ef58a1032e3b336587e2f3a19659ae325c25.tar.gz libimobiledevice-6a83ef58a1032e3b336587e2f3a19659ae325c25.tar.bz2 | |
Remove gthread dependency and use pthreads instead
Diffstat (limited to 'src/sbservices.c')
| -rw-r--r-- | src/sbservices.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/sbservices.c b/src/sbservices.c index 3596cbd..dd5f571 100644 --- a/src/sbservices.c +++ b/src/sbservices.c | |||
| @@ -36,7 +36,7 @@ | |||
| 36 | static void sbs_lock(sbservices_client_t client) | 36 | static void sbs_lock(sbservices_client_t client) |
| 37 | { | 37 | { |
| 38 | debug_info("SBServices: Locked"); | 38 | debug_info("SBServices: Locked"); |
| 39 | g_mutex_lock(client->mutex); | 39 | pthread_mutex_lock(&client->mutex); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | /** | 42 | /** |
| @@ -47,7 +47,7 @@ static void sbs_lock(sbservices_client_t client) | |||
| 47 | static void sbs_unlock(sbservices_client_t client) | 47 | static void sbs_unlock(sbservices_client_t client) |
| 48 | { | 48 | { |
| 49 | debug_info("SBServices: Unlocked"); | 49 | debug_info("SBServices: Unlocked"); |
| 50 | g_mutex_unlock(client->mutex); | 50 | pthread_mutex_unlock(&client->mutex); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | /** | 53 | /** |
| @@ -89,10 +89,6 @@ static sbservices_error_t sbservices_error(property_list_service_error_t err) | |||
| 89 | */ | 89 | */ |
| 90 | sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client) | 90 | sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client) |
| 91 | { | 91 | { |
| 92 | /* makes sure thread environment is available */ | ||
| 93 | if (!g_thread_supported()) | ||
| 94 | g_thread_init(NULL); | ||
| 95 | |||
| 96 | if (!device) | 92 | if (!device) |
| 97 | return SBSERVICES_E_INVALID_ARG; | 93 | return SBSERVICES_E_INVALID_ARG; |
| 98 | 94 | ||
| @@ -104,7 +100,7 @@ sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbserv | |||
| 104 | 100 | ||
| 105 | sbservices_client_t client_loc = (sbservices_client_t) malloc(sizeof(struct sbservices_client_private)); | 101 | sbservices_client_t client_loc = (sbservices_client_t) malloc(sizeof(struct sbservices_client_private)); |
| 106 | client_loc->parent = plistclient; | 102 | client_loc->parent = plistclient; |
| 107 | client_loc->mutex = g_mutex_new(); | 103 | pthread_mutex_init(&client_loc->mutex, NULL); |
| 108 | 104 | ||
| 109 | *client = client_loc; | 105 | *client = client_loc; |
| 110 | return SBSERVICES_E_SUCCESS; | 106 | return SBSERVICES_E_SUCCESS; |
| @@ -126,9 +122,7 @@ sbservices_error_t sbservices_client_free(sbservices_client_t client) | |||
| 126 | 122 | ||
| 127 | sbservices_error_t err = sbservices_error(property_list_service_client_free(client->parent)); | 123 | sbservices_error_t err = sbservices_error(property_list_service_client_free(client->parent)); |
| 128 | client->parent = NULL; | 124 | client->parent = NULL; |
| 129 | if (client->mutex) { | 125 | pthread_mutex_destroy(&client->mutex); |
| 130 | g_mutex_free(client->mutex); | ||
| 131 | } | ||
| 132 | free(client); | 126 | free(client); |
| 133 | 127 | ||
| 134 | return err; | 128 | return err; |
