diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 2 | ||||
-rw-r--r-- | tools/idevicesyslog.c | 29 |
2 files changed, 7 insertions, 24 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 57445d8..e668592 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -18,7 +18,7 @@ idevicepair_LDADD = ../src/libimobiledevice.la idevicesyslog_SOURCES = idevicesyslog.c idevicesyslog_CFLAGS = $(AM_CFLAGS) idevicesyslog_LDFLAGS = $(AM_LDFLAGS) -idevicesyslog_LDADD = ../src/libimobiledevice.la +idevicesyslog_LDADD = $(top_srcdir)/common/libinternalcommon.la ../src/libimobiledevice.la idevice_id_SOURCES = idevice_id.c idevice_id_CFLAGS = $(AM_CFLAGS) diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c index 32163e6..3dd2257 100644 --- a/tools/idevicesyslog.c +++ b/tools/idevicesyslog.c @@ -29,13 +29,13 @@ #ifdef WIN32 #include <windows.h> #define sleep(x) Sleep(x*1000) -#else -#include <pthread.h> #endif #include <libimobiledevice/libimobiledevice.h> #include <libimobiledevice/lockdown.h> -#include "../src/service.h" + +#include "src/service.h" +#include "common/thread.h" static int quit_flag = 0; @@ -46,11 +46,7 @@ static char* udid = NULL; static idevice_t device = NULL; static service_client_t syslog = NULL; -#ifdef WIN32 -HANDLE worker = NULL; -#else -pthread_t worker; -#endif +thread_t worker = NULL; static int logging = 0; @@ -100,19 +96,10 @@ static int start_logging() /* start worker thread */ logging = 1; -#ifdef WIN32 - worker = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)syslog_worker, NULL, 0, NULL); - if (worker == INVALID_HANDLE_VALUE) { + if (thread_create(&worker, syslog_worker, NULL) != 0) { logging = 0; return -1; } -#else - if (pthread_create(&worker, NULL, syslog_worker, NULL) != 0) { - logging = 0; - return -1; - } -#endif - return 0; } @@ -127,11 +114,7 @@ static void stop_logging() } /* wait for thread to complete */ -#ifdef WIN32 - WaitForSingleObject(worker, INFINITE); -#else - pthread_join(worker, NULL); -#endif + thread_join(worker); } if (device) { |