diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libusbmuxd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c index 327746b..2897da6 100644 --- a/src/libusbmuxd.c +++ b/src/libusbmuxd.c @@ -806,6 +806,7 @@ USBMUXD_API int usbmuxd_subscribe(usbmuxd_event_cb_t callback, void *user_data) USBMUXD_API int usbmuxd_unsubscribe() { + int res; event_cb = NULL; socket_shutdown(listenfd, SHUT_RDWR); @@ -815,9 +816,13 @@ USBMUXD_API int usbmuxd_unsubscribe() WaitForSingleObject(devmon, INFINITE); } #else - if (pthread_kill(devmon, 0) == 0) { + res = pthread_kill(devmon, 0); + if (res == 0) { pthread_cancel(devmon); - pthread_join(devmon, NULL); + res = pthread_join(devmon, NULL); + } + if ((res != 0) && (res != ESRCH)) { + return res; } #endif |