summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-06-11 01:12:49 +0200
committerGravatar Nikias Bassen2019-06-11 01:12:49 +0200
commit59adbacef6d400d4c6458f26daddda24bcdfd635 (patch)
treefab41dc53822655f4be988017be4031be64cac33 /src
parent34444782e22ebfd2abc9e5e9c27e170a839ff66b (diff)
downloadlibimobiledevice-59adbacef6d400d4c6458f26daddda24bcdfd635.tar.gz
libimobiledevice-59adbacef6d400d4c6458f26daddda24bcdfd635.tar.bz2
common: Update thread.c/.h to match the one from libusbmuxd
Diffstat (limited to 'src')
-rw-r--r--src/installation_proxy.c11
-rw-r--r--src/installation_proxy.h2
-rw-r--r--src/notification_proxy.c6
-rw-r--r--src/notification_proxy.h2
-rw-r--r--src/syslog_relay.c8
-rw-r--r--src/syslog_relay.h2
6 files changed, 17 insertions, 14 deletions
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index f82eecc..24044aa 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -20,6 +20,9 @@
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */ 21 */
22 22
23#ifdef HAVE_CONFIG_H
24#include <config.h>
25#endif
23#include <string.h> 26#include <string.h>
24#include <stdlib.h> 27#include <stdlib.h>
25#include <inttypes.h> 28#include <inttypes.h>
@@ -240,7 +243,7 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_new(idevice_t device, lo
240 instproxy_client_t client_loc = (instproxy_client_t) malloc(sizeof(struct instproxy_client_private)); 243 instproxy_client_t client_loc = (instproxy_client_t) malloc(sizeof(struct instproxy_client_private));
241 client_loc->parent = plistclient; 244 client_loc->parent = plistclient;
242 mutex_init(&client_loc->mutex); 245 mutex_init(&client_loc->mutex);
243 client_loc->receive_status_thread = (thread_t)NULL; 246 client_loc->receive_status_thread = THREAD_T_NULL;
244 247
245 *client = client_loc; 248 *client = client_loc;
246 return INSTPROXY_E_SUCCESS; 249 return INSTPROXY_E_SUCCESS;
@@ -264,7 +267,7 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_free(instproxy_client_t
264 debug_info("joining receive_status_thread"); 267 debug_info("joining receive_status_thread");
265 thread_join(client->receive_status_thread); 268 thread_join(client->receive_status_thread);
266 thread_free(client->receive_status_thread); 269 thread_free(client->receive_status_thread);
267 client->receive_status_thread = (thread_t)NULL; 270 client->receive_status_thread = THREAD_T_NULL;
268 } 271 }
269 mutex_destroy(&client->mutex); 272 mutex_destroy(&client->mutex);
270 free(client); 273 free(client);
@@ -343,7 +346,7 @@ static instproxy_error_t instproxy_receive_status_loop(instproxy_client_t client
343 346
344 /* parse status response */ 347 /* parse status response */
345 if (node) { 348 if (node) {
346 /* check status for possible error to allow reporting it and aborting it gracefully */ 349 /* check status for possible error to allow reporting it and aborting it gracefully */
347 res = instproxy_status_get_error(node, &error_name, &error_description, &error_code); 350 res = instproxy_status_get_error(node, &error_name, &error_description, &error_code);
348 if (res != INSTPROXY_E_SUCCESS) { 351 if (res != INSTPROXY_E_SUCCESS) {
349 debug_info("command: %s, error %d, code 0x%08"PRIx64", name: %s, description: \"%s\"", command_name, res, error_code, error_name, error_description ? error_description: "N/A"); 352 debug_info("command: %s, error %d, code 0x%08"PRIx64", name: %s, description: \"%s\"", command_name, res, error_code, error_name, error_description ? error_description: "N/A");
@@ -431,7 +434,7 @@ static void* instproxy_receive_status_loop_thread(void* arg)
431 434
432 if (data->client->receive_status_thread) { 435 if (data->client->receive_status_thread) {
433 thread_free(data->client->receive_status_thread); 436 thread_free(data->client->receive_status_thread);
434 data->client->receive_status_thread = (thread_t)NULL; 437 data->client->receive_status_thread = THREAD_T_NULL;
435 } 438 }
436 439
437 instproxy_unlock(data->client); 440 instproxy_unlock(data->client);
diff --git a/src/installation_proxy.h b/src/installation_proxy.h
index bbc14ce..66dd5d0 100644
--- a/src/installation_proxy.h
+++ b/src/installation_proxy.h
@@ -30,7 +30,7 @@
30struct instproxy_client_private { 30struct instproxy_client_private {
31 property_list_service_client_t parent; 31 property_list_service_client_t parent;
32 mutex_t mutex; 32 mutex_t mutex;
33 thread_t receive_status_thread; 33 THREAD_T receive_status_thread;
34}; 34};
35 35
36#endif 36#endif
diff --git a/src/notification_proxy.c b/src/notification_proxy.c
index c0b216e..3015ed9 100644
--- a/src/notification_proxy.c
+++ b/src/notification_proxy.c
@@ -98,7 +98,7 @@ LIBIMOBILEDEVICE_API np_error_t np_client_new(idevice_t device, lockdownd_servic
98 client_loc->parent = plistclient; 98 client_loc->parent = plistclient;
99 99
100 mutex_init(&client_loc->mutex); 100 mutex_init(&client_loc->mutex);
101 client_loc->notifier = (thread_t)NULL; 101 client_loc->notifier = THREAD_T_NULL;
102 102
103 *client = client_loc; 103 *client = client_loc;
104 return NP_E_SUCCESS; 104 return NP_E_SUCCESS;
@@ -132,7 +132,7 @@ LIBIMOBILEDEVICE_API np_error_t np_client_free(np_client_t client)
132 debug_info("joining np callback"); 132 debug_info("joining np callback");
133 thread_join(client->notifier); 133 thread_join(client->notifier);
134 thread_free(client->notifier); 134 thread_free(client->notifier);
135 client->notifier = (thread_t)NULL; 135 client->notifier = THREAD_T_NULL;
136 } else { 136 } else {
137 dict = NULL; 137 dict = NULL;
138 property_list_service_receive_plist(parent, &dict); 138 property_list_service_receive_plist(parent, &dict);
@@ -350,7 +350,7 @@ LIBIMOBILEDEVICE_API np_error_t np_set_notify_callback( np_client_t client, np_n
350 client->parent = NULL; 350 client->parent = NULL;
351 thread_join(client->notifier); 351 thread_join(client->notifier);
352 thread_free(client->notifier); 352 thread_free(client->notifier);
353 client->notifier = (thread_t)NULL; 353 client->notifier = THREAD_T_NULL;
354 client->parent = parent; 354 client->parent = parent;
355 } 355 }
356 356
diff --git a/src/notification_proxy.h b/src/notification_proxy.h
index cc25a95..f641e25 100644
--- a/src/notification_proxy.h
+++ b/src/notification_proxy.h
@@ -29,7 +29,7 @@
29struct np_client_private { 29struct np_client_private {
30 property_list_service_client_t parent; 30 property_list_service_client_t parent;
31 mutex_t mutex; 31 mutex_t mutex;
32 thread_t notifier; 32 THREAD_T notifier;
33}; 33};
34 34
35void* np_notifier(void* arg); 35void* np_notifier(void* arg);
diff --git a/src/syslog_relay.c b/src/syslog_relay.c
index 29f4de5..3be84e0 100644
--- a/src/syslog_relay.c
+++ b/src/syslog_relay.c
@@ -81,7 +81,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_client_new(idevice_t devi
81 81
82 syslog_relay_client_t client_loc = (syslog_relay_client_t) malloc(sizeof(struct syslog_relay_client_private)); 82 syslog_relay_client_t client_loc = (syslog_relay_client_t) malloc(sizeof(struct syslog_relay_client_private));
83 client_loc->parent = parent; 83 client_loc->parent = parent;
84 client_loc->worker = (thread_t)NULL; 84 client_loc->worker = THREAD_T_NULL;
85 85
86 *client = client_loc; 86 *client = client_loc;
87 87
@@ -107,7 +107,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_client_free(syslog_relay_
107 debug_info("Joining syslog capture callback worker thread"); 107 debug_info("Joining syslog capture callback worker thread");
108 thread_join(client->worker); 108 thread_join(client->worker);
109 thread_free(client->worker); 109 thread_free(client->worker);
110 client->worker = (thread_t)NULL; 110 client->worker = THREAD_T_NULL;
111 } 111 }
112 free(client); 112 free(client);
113 113
@@ -209,9 +209,9 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_stop_capture(syslog_relay
209 /* join thread to make it exit */ 209 /* join thread to make it exit */
210 thread_join(client->worker); 210 thread_join(client->worker);
211 thread_free(client->worker); 211 thread_free(client->worker);
212 client->worker = (thread_t)NULL; 212 client->worker = THREAD_T_NULL;
213 client->parent = parent; 213 client->parent = parent;
214 } 214 }
215 215
216 return SYSLOG_RELAY_E_SUCCESS; 216 return SYSLOG_RELAY_E_SUCCESS;
217} \ No newline at end of file 217}
diff --git a/src/syslog_relay.h b/src/syslog_relay.h
index cd45775..3e48fa4 100644
--- a/src/syslog_relay.h
+++ b/src/syslog_relay.h
@@ -28,7 +28,7 @@
28 28
29struct syslog_relay_client_private { 29struct syslog_relay_client_private {
30 service_client_t parent; 30 service_client_t parent;
31 thread_t worker; 31 THREAD_T worker;
32}; 32};
33 33
34void *syslog_relay_worker(void *arg); 34void *syslog_relay_worker(void *arg);