diff options
author | Nikias Bassen | 2021-09-01 15:54:53 +0200 |
---|---|---|
committer | Nikias Bassen | 2021-09-01 15:54:53 +0200 |
commit | 32a8ebedc695dfae21497977bf2f77a3d5b50f91 (patch) | |
tree | 0cfd7f83c4d49ee4a20ecdc249167f6dc084396d /src/preflight.c | |
parent | c3a16f3e4968f38aa8813ad0c0731bdb5aa745fb (diff) | |
download | usbmuxd-32a8ebedc695dfae21497977bf2f77a3d5b50f91.tar.gz usbmuxd-32a8ebedc695dfae21497977bf2f77a3d5b50f91.tar.bz2 |
Remove common code in favor of new libimobiledevice-glue
Diffstat (limited to 'src/preflight.c')
-rw-r--r-- | src/preflight.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/preflight.c b/src/preflight.c index 6a303c2..5902f5d 100644 --- a/src/preflight.c +++ b/src/preflight.c @@ -26,8 +26,6 @@ #include <unistd.h> #include <errno.h> -#include <pthread.h> - #include <sys/time.h> #ifdef HAVE_LIBIMOBILEDEVICE @@ -36,6 +34,8 @@ #include <libimobiledevice/notification_proxy.h> #endif +#include <libimobiledevice-glue/thread.h> + #include "preflight.h" #include "device.h" #include "client.h" @@ -389,18 +389,15 @@ void preflight_worker_device_add(struct device_info* info) infocopy->serial = strdup(info->serial); } - pthread_t th; - pthread_attr_t attr; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - int perr = pthread_create(&th, &attr, preflight_worker_handle_device_add, infocopy); + THREAD_T th; + int perr = thread_new(&th, preflight_worker_handle_device_add, infocopy); if (perr != 0) { free((char*)infocopy->serial); free(infocopy); usbmuxd_log(LL_ERROR, "ERROR: failed to start preflight worker thread for device %s: %s (%d). Invoking client_device_add() directly but things might not work as expected.", info->serial, strerror(perr), perr); client_device_add(info); + } else { + thread_detach(th); } #else client_device_add(info); |