Report pthread_kill/pthread_join errors in usbmuxd_unsubscribe

In order to avoid race condition between an usbmuxd_event_cb_t firing in
a different thread and usbmuxd_unsubscribe() being called, libusbmuxd
users must assume that once usbmuxd_unsubcribe() returns, no more
usbmuxd_event_cb_t callbacks will fire, but also that those which were
already started when usbmuxd_unsubcribe() is called will have completed.

usbmuxd_unsubcribe() tries to guarantee this, but
pthread_kill/pthread_join may fail, in which case this guarantee would
not hold. This commit makes sure an error is reported to the caller when
we get in this situation (though I'm not really sure how the caller
could handle it).
1 file changed