summaryrefslogtreecommitdiffstats
path: root/src/preflight.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2021-09-01 15:54:53 +0200
committerGravatar Nikias Bassen2021-09-01 15:54:53 +0200
commit32a8ebedc695dfae21497977bf2f77a3d5b50f91 (patch)
tree0cfd7f83c4d49ee4a20ecdc249167f6dc084396d /src/preflight.c
parentc3a16f3e4968f38aa8813ad0c0731bdb5aa745fb (diff)
downloadusbmuxd-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.c15
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 @@
26#include <unistd.h> 26#include <unistd.h>
27#include <errno.h> 27#include <errno.h>
28 28
29#include <pthread.h>
30
31#include <sys/time.h> 29#include <sys/time.h>
32 30
33#ifdef HAVE_LIBIMOBILEDEVICE 31#ifdef HAVE_LIBIMOBILEDEVICE
@@ -36,6 +34,8 @@
36#include <libimobiledevice/notification_proxy.h> 34#include <libimobiledevice/notification_proxy.h>
37#endif 35#endif
38 36
37#include <libimobiledevice-glue/thread.h>
38
39#include "preflight.h" 39#include "preflight.h"
40#include "device.h" 40#include "device.h"
41#include "client.h" 41#include "client.h"
@@ -389,18 +389,15 @@ void preflight_worker_device_add(struct device_info* info)
389 infocopy->serial = strdup(info->serial); 389 infocopy->serial = strdup(info->serial);
390 } 390 }
391 391
392 pthread_t th; 392 THREAD_T th;
393 pthread_attr_t attr; 393 int perr = thread_new(&th, preflight_worker_handle_device_add, infocopy);
394
395 pthread_attr_init(&attr);
396 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
397
398 int perr = pthread_create(&th, &attr, preflight_worker_handle_device_add, infocopy);
399 if (perr != 0) { 394 if (perr != 0) {
400 free((char*)infocopy->serial); 395 free((char*)infocopy->serial);
401 free(infocopy); 396 free(infocopy);
402 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); 397 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);
403 client_device_add(info); 398 client_device_add(info);
399 } else {
400 thread_detach(th);
404 } 401 }
405#else 402#else
406 client_device_add(info); 403 client_device_add(info);