diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/installation_proxy.c | 11 | ||||
-rw-r--r-- | src/notification_proxy.c | 5 | ||||
-rw-r--r-- | src/syslog_relay.c | 5 |
3 files changed, 16 insertions, 5 deletions
diff --git a/src/installation_proxy.c b/src/installation_proxy.c index d17d6c5..9a11e36 100644 --- a/src/installation_proxy.c +++ b/src/installation_proxy.c @@ -120,6 +120,8 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_free(instproxy_client_t if (client->status_updater) { debug_info("joining status_updater"); thread_join(client->status_updater); + thread_free(client->status_updater); + client->status_updater = (thread_t)NULL; } mutex_destroy(&client->mutex); free(client); @@ -320,7 +322,7 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client, * @return Always NULL. */ static void* instproxy_status_updater(void* arg) -{ +{ struct instproxy_status_data *data = (struct instproxy_status_data*)arg; /* run until the operation is complete or an error occurs */ @@ -332,7 +334,10 @@ static void* instproxy_status_updater(void* arg) if (data->operation) { free(data->operation); } - data->client->status_updater = (thread_t)NULL; + if (data->client->status_updater) { + thread_free(data->client->status_updater); + data->client->status_updater = (thread_t)NULL; + } instproxy_unlock(data->client); free(data); @@ -367,7 +372,7 @@ static instproxy_error_t instproxy_create_status_updater(instproxy_client_t clie data->operation = strdup(operation); data->user_data = user_data; - if (thread_create(&client->status_updater, instproxy_status_updater, data) == 0) { + if (thread_new(&client->status_updater, instproxy_status_updater, data) == 0) { res = INSTPROXY_E_SUCCESS; } } diff --git a/src/notification_proxy.c b/src/notification_proxy.c index 4b028f6..b22448d 100644 --- a/src/notification_proxy.c +++ b/src/notification_proxy.c @@ -131,6 +131,8 @@ LIBIMOBILEDEVICE_API np_error_t np_client_free(np_client_t client) if (client->notifier) { debug_info("joining np callback"); thread_join(client->notifier); + thread_free(client->notifier); + client->notifier = (thread_t)NULL; } else { dict = NULL; property_list_service_receive_plist(parent, &dict); @@ -347,6 +349,7 @@ LIBIMOBILEDEVICE_API np_error_t np_set_notify_callback( np_client_t client, np_n property_list_service_client_t parent = client->parent; client->parent = NULL; thread_join(client->notifier); + thread_free(client->notifier); client->notifier = (thread_t)NULL; client->parent = parent; } @@ -358,7 +361,7 @@ LIBIMOBILEDEVICE_API np_error_t np_set_notify_callback( np_client_t client, np_n npt->cbfunc = notify_cb; npt->user_data = user_data; - if (thread_create(&client->notifier, np_notifier, npt) == 0) { + if (thread_new(&client->notifier, np_notifier, npt) == 0) { res = NP_E_SUCCESS; } } diff --git a/src/syslog_relay.c b/src/syslog_relay.c index 44006ce..5ef64cd 100644 --- a/src/syslog_relay.c +++ b/src/syslog_relay.c @@ -106,6 +106,8 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_client_free(syslog_relay_ if (client->worker) { debug_info("Joining syslog capture callback worker thread"); thread_join(client->worker); + thread_free(client->worker); + client->worker = (thread_t)NULL; } free(client); @@ -190,7 +192,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_start_capture(syslog_rela srwt->cbfunc = callback; srwt->user_data = user_data; - if (thread_create(&client->worker, syslog_relay_worker, srwt) == 0) { + if (thread_new(&client->worker, syslog_relay_worker, srwt) == 0) { res = SYSLOG_RELAY_E_SUCCESS; } } @@ -206,6 +208,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_stop_capture(syslog_relay client->parent = NULL; /* join thread to make it exit */ thread_join(client->worker); + thread_free(client->worker); client->worker = (thread_t)NULL; client->parent = parent; } |