From 59adbacef6d400d4c6458f26daddda24bcdfd635 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 11 Jun 2019 01:12:49 +0200 Subject: common: Update thread.c/.h to match the one from libusbmuxd --- src/installation_proxy.c | 11 +++++++---- src/installation_proxy.h | 2 +- src/notification_proxy.c | 6 +++--- src/notification_proxy.h | 2 +- src/syslog_relay.c | 8 ++++---- src/syslog_relay.h | 2 +- 6 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src') 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 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include +#endif #include #include #include @@ -240,7 +243,7 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_new(idevice_t device, lo instproxy_client_t client_loc = (instproxy_client_t) malloc(sizeof(struct instproxy_client_private)); client_loc->parent = plistclient; mutex_init(&client_loc->mutex); - client_loc->receive_status_thread = (thread_t)NULL; + client_loc->receive_status_thread = THREAD_T_NULL; *client = client_loc; return INSTPROXY_E_SUCCESS; @@ -264,7 +267,7 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_free(instproxy_client_t debug_info("joining receive_status_thread"); thread_join(client->receive_status_thread); thread_free(client->receive_status_thread); - client->receive_status_thread = (thread_t)NULL; + client->receive_status_thread = THREAD_T_NULL; } mutex_destroy(&client->mutex); free(client); @@ -343,7 +346,7 @@ static instproxy_error_t instproxy_receive_status_loop(instproxy_client_t client /* parse status response */ if (node) { - /* check status for possible errorĀ to allow reporting it and aborting it gracefully */ + /* check status for possible error to allow reporting it and aborting it gracefully */ res = instproxy_status_get_error(node, &error_name, &error_description, &error_code); if (res != INSTPROXY_E_SUCCESS) { 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) if (data->client->receive_status_thread) { thread_free(data->client->receive_status_thread); - data->client->receive_status_thread = (thread_t)NULL; + data->client->receive_status_thread = THREAD_T_NULL; } 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 @@ struct instproxy_client_private { property_list_service_client_t parent; mutex_t mutex; - thread_t receive_status_thread; + THREAD_T receive_status_thread; }; #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 client_loc->parent = plistclient; mutex_init(&client_loc->mutex); - client_loc->notifier = (thread_t)NULL; + client_loc->notifier = THREAD_T_NULL; *client = client_loc; return NP_E_SUCCESS; @@ -132,7 +132,7 @@ LIBIMOBILEDEVICE_API np_error_t np_client_free(np_client_t client) debug_info("joining np callback"); thread_join(client->notifier); thread_free(client->notifier); - client->notifier = (thread_t)NULL; + client->notifier = THREAD_T_NULL; } else { dict = NULL; 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 client->parent = NULL; thread_join(client->notifier); thread_free(client->notifier); - client->notifier = (thread_t)NULL; + client->notifier = THREAD_T_NULL; client->parent = parent; } 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 @@ struct np_client_private { property_list_service_client_t parent; mutex_t mutex; - thread_t notifier; + THREAD_T notifier; }; void* 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 syslog_relay_client_t client_loc = (syslog_relay_client_t) malloc(sizeof(struct syslog_relay_client_private)); client_loc->parent = parent; - client_loc->worker = (thread_t)NULL; + client_loc->worker = THREAD_T_NULL; *client = client_loc; @@ -107,7 +107,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_client_free(syslog_relay_ debug_info("Joining syslog capture callback worker thread"); thread_join(client->worker); thread_free(client->worker); - client->worker = (thread_t)NULL; + client->worker = THREAD_T_NULL; } free(client); @@ -209,9 +209,9 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_stop_capture(syslog_relay /* join thread to make it exit */ thread_join(client->worker); thread_free(client->worker); - client->worker = (thread_t)NULL; + client->worker = THREAD_T_NULL; client->parent = parent; } return SYSLOG_RELAY_E_SUCCESS; -} \ No newline at end of file +} 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 @@ struct syslog_relay_client_private { service_client_t parent; - thread_t worker; + THREAD_T worker; }; void *syslog_relay_worker(void *arg); -- cgit v1.1-32-gdbae