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 | |||
| 120 | if (client->status_updater) { | 120 | if (client->status_updater) { |
| 121 | debug_info("joining status_updater"); | 121 | debug_info("joining status_updater"); |
| 122 | thread_join(client->status_updater); | 122 | thread_join(client->status_updater); |
| 123 | thread_free(client->status_updater); | ||
| 124 | client->status_updater = (thread_t)NULL; | ||
| 123 | } | 125 | } |
| 124 | mutex_destroy(&client->mutex); | 126 | mutex_destroy(&client->mutex); |
| 125 | free(client); | 127 | free(client); |
| @@ -320,7 +322,7 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client, | |||
| 320 | * @return Always NULL. | 322 | * @return Always NULL. |
| 321 | */ | 323 | */ |
| 322 | static void* instproxy_status_updater(void* arg) | 324 | static void* instproxy_status_updater(void* arg) |
| 323 | { | 325 | { |
| 324 | struct instproxy_status_data *data = (struct instproxy_status_data*)arg; | 326 | struct instproxy_status_data *data = (struct instproxy_status_data*)arg; |
| 325 | 327 | ||
| 326 | /* run until the operation is complete or an error occurs */ | 328 | /* run until the operation is complete or an error occurs */ |
| @@ -332,7 +334,10 @@ static void* instproxy_status_updater(void* arg) | |||
| 332 | if (data->operation) { | 334 | if (data->operation) { |
| 333 | free(data->operation); | 335 | free(data->operation); |
| 334 | } | 336 | } |
| 335 | data->client->status_updater = (thread_t)NULL; | 337 | if (data->client->status_updater) { |
| 338 | thread_free(data->client->status_updater); | ||
| 339 | data->client->status_updater = (thread_t)NULL; | ||
| 340 | } | ||
| 336 | instproxy_unlock(data->client); | 341 | instproxy_unlock(data->client); |
| 337 | free(data); | 342 | free(data); |
| 338 | 343 | ||
| @@ -367,7 +372,7 @@ static instproxy_error_t instproxy_create_status_updater(instproxy_client_t clie | |||
| 367 | data->operation = strdup(operation); | 372 | data->operation = strdup(operation); |
| 368 | data->user_data = user_data; | 373 | data->user_data = user_data; |
| 369 | 374 | ||
| 370 | if (thread_create(&client->status_updater, instproxy_status_updater, data) == 0) { | 375 | if (thread_new(&client->status_updater, instproxy_status_updater, data) == 0) { |
| 371 | res = INSTPROXY_E_SUCCESS; | 376 | res = INSTPROXY_E_SUCCESS; |
| 372 | } | 377 | } |
| 373 | } | 378 | } |
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) | |||
| 131 | if (client->notifier) { | 131 | if (client->notifier) { |
| 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); | ||
| 135 | client->notifier = (thread_t)NULL; | ||
| 134 | } else { | 136 | } else { |
| 135 | dict = NULL; | 137 | dict = NULL; |
| 136 | property_list_service_receive_plist(parent, &dict); | 138 | 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 | |||
| 347 | property_list_service_client_t parent = client->parent; | 349 | property_list_service_client_t parent = client->parent; |
| 348 | client->parent = NULL; | 350 | client->parent = NULL; |
| 349 | thread_join(client->notifier); | 351 | thread_join(client->notifier); |
| 352 | thread_free(client->notifier); | ||
| 350 | client->notifier = (thread_t)NULL; | 353 | client->notifier = (thread_t)NULL; |
| 351 | client->parent = parent; | 354 | client->parent = parent; |
| 352 | } | 355 | } |
| @@ -358,7 +361,7 @@ LIBIMOBILEDEVICE_API np_error_t np_set_notify_callback( np_client_t client, np_n | |||
| 358 | npt->cbfunc = notify_cb; | 361 | npt->cbfunc = notify_cb; |
| 359 | npt->user_data = user_data; | 362 | npt->user_data = user_data; |
| 360 | 363 | ||
| 361 | if (thread_create(&client->notifier, np_notifier, npt) == 0) { | 364 | if (thread_new(&client->notifier, np_notifier, npt) == 0) { |
| 362 | res = NP_E_SUCCESS; | 365 | res = NP_E_SUCCESS; |
| 363 | } | 366 | } |
| 364 | } | 367 | } |
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_ | |||
| 106 | if (client->worker) { | 106 | if (client->worker) { |
| 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); | ||
| 110 | client->worker = (thread_t)NULL; | ||
| 109 | } | 111 | } |
| 110 | free(client); | 112 | free(client); |
| 111 | 113 | ||
| @@ -190,7 +192,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_start_capture(syslog_rela | |||
| 190 | srwt->cbfunc = callback; | 192 | srwt->cbfunc = callback; |
| 191 | srwt->user_data = user_data; | 193 | srwt->user_data = user_data; |
| 192 | 194 | ||
| 193 | if (thread_create(&client->worker, syslog_relay_worker, srwt) == 0) { | 195 | if (thread_new(&client->worker, syslog_relay_worker, srwt) == 0) { |
| 194 | res = SYSLOG_RELAY_E_SUCCESS; | 196 | res = SYSLOG_RELAY_E_SUCCESS; |
| 195 | } | 197 | } |
| 196 | } | 198 | } |
| @@ -206,6 +208,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_stop_capture(syslog_relay | |||
| 206 | client->parent = NULL; | 208 | client->parent = NULL; |
| 207 | /* join thread to make it exit */ | 209 | /* join thread to make it exit */ |
| 208 | thread_join(client->worker); | 210 | thread_join(client->worker); |
| 211 | thread_free(client->worker); | ||
| 209 | client->worker = (thread_t)NULL; | 212 | client->worker = (thread_t)NULL; |
| 210 | client->parent = parent; | 213 | client->parent = parent; |
| 211 | } | 214 | } |
