summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2011-09-03 02:07:09 +0200
committerGravatar Martin Szulecki2012-03-18 20:40:54 +0100
commit6a83ef58a1032e3b336587e2f3a19659ae325c25 (patch)
tree27e12297bc66bd22a0cfc86459413a49a0d998f2 /dev
parentb586203dbef26f9e94325b57867478eda504e5a1 (diff)
downloadlibimobiledevice-6a83ef58a1032e3b336587e2f3a19659ae325c25.tar.gz
libimobiledevice-6a83ef58a1032e3b336587e2f3a19659ae325c25.tar.bz2
Remove gthread dependency and use pthreads instead
Diffstat (limited to 'dev')
-rw-r--r--dev/afccheck.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/dev/afccheck.c b/dev/afccheck.c
index b4d8910..2dab6db 100644
--- a/dev/afccheck.c
+++ b/dev/afccheck.c
@@ -22,7 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <glib.h>
+#include <pthread.h>
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
@@ -38,7 +38,7 @@ typedef struct {
} param;
-static void check_afc(gpointer data)
+static void* check_afc(void *data)
{
//prepare a buffer
unsigned int buffersize = BUFFER_SIZE * sizeof(unsigned int);
@@ -85,14 +85,13 @@ static void check_afc(gpointer data)
//cleanup
afc_remove_path(((param *) data)->afc, path);
- g_thread_exit(0);
+ pthread_exit(0);
}
int main(int argc, char *argv[])
{
lockdownd_client_t client = NULL;
idevice_t phone = NULL;
- GError *err;
uint16_t port = 0;
afc_client_t afc = NULL;
@@ -121,22 +120,18 @@ int main(int argc, char *argv[])
afc_client_new(phone, port, &afc);
- //makes sure thread environment is available
- if (!g_thread_supported())
- g_thread_init(NULL);
-
- GThread *threads[NB_THREADS];
+ pthread_t threads[NB_THREADS];
param data[NB_THREADS];
int i = 0;
for (i = 0; i < NB_THREADS; i++) {
data[i].afc = afc;
data[i].id = i + 1;
- threads[i] = g_thread_create((GThreadFunc) check_afc, data + i, TRUE, &err);
+ pthread_create(&threads[i], NULL, check_afc, data + i);
}
for (i = 0; i < NB_THREADS; i++) {
- g_thread_join(threads[i]);
+ pthread_join(threads[i], NULL);
}
lockdownd_client_free(client);