diff options
| author | 2013-03-20 05:38:06 +0100 | |
|---|---|---|
| committer | 2013-03-20 05:38:06 +0100 | |
| commit | b2924a1549d874fb86deaad5fd2438e567c65bf4 (patch) | |
| tree | ead89f885a0492cdfc228a1c25326912e7d9b973 /dev | |
| parent | efca491e4c19868a68a099638552f9ba431dca4b (diff) | |
| download | libimobiledevice-b2924a1549d874fb86deaad5fd2438e567c65bf4.tar.gz libimobiledevice-b2924a1549d874fb86deaad5fd2438e567c65bf4.tar.bz2 | |
use new internal common code for thread, mutex, and socket operations
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/afccheck.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/dev/afccheck.c b/dev/afccheck.c index 665aa47..3eb53c8 100644 --- a/dev/afccheck.c +++ b/dev/afccheck.c | |||
| @@ -22,11 +22,11 @@ | |||
| 22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| 24 | #include <string.h> | 24 | #include <string.h> |
| 25 | #include <pthread.h> | ||
| 26 | 25 | ||
| 27 | #include <libimobiledevice/libimobiledevice.h> | 26 | #include <libimobiledevice/libimobiledevice.h> |
| 28 | #include <libimobiledevice/lockdown.h> | 27 | #include <libimobiledevice/lockdown.h> |
| 29 | #include <libimobiledevice/afc.h> | 28 | #include <libimobiledevice/afc.h> |
| 29 | #include "common/thread.h" | ||
| 30 | 30 | ||
| 31 | #define BUFFER_SIZE 20000 | 31 | #define BUFFER_SIZE 20000 |
| 32 | #define NB_THREADS 10 | 32 | #define NB_THREADS 10 |
| @@ -85,7 +85,7 @@ static void* check_afc(void *data) | |||
| 85 | 85 | ||
| 86 | //cleanup | 86 | //cleanup |
| 87 | afc_remove_path(((param *) data)->afc, path); | 87 | afc_remove_path(((param *) data)->afc, path); |
| 88 | pthread_exit(0); | 88 | return NULL; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | int main(int argc, char *argv[]) | 91 | int main(int argc, char *argv[]) |
| @@ -125,18 +125,18 @@ int main(int argc, char *argv[]) | |||
| 125 | service = NULL; | 125 | service = NULL; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | pthread_t threads[NB_THREADS]; | 128 | thread_t threads[NB_THREADS]; |
| 129 | param data[NB_THREADS]; | 129 | param data[NB_THREADS]; |
| 130 | 130 | ||
| 131 | int i = 0; | 131 | int i = 0; |
| 132 | for (i = 0; i < NB_THREADS; i++) { | 132 | for (i = 0; i < NB_THREADS; i++) { |
| 133 | data[i].afc = afc; | 133 | data[i].afc = afc; |
| 134 | data[i].id = i + 1; | 134 | data[i].id = i + 1; |
| 135 | pthread_create(&threads[i], NULL, check_afc, data + i); | 135 | thread_create(&threads[i], check_afc, data + i); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | for (i = 0; i < NB_THREADS; i++) { | 138 | for (i = 0; i < NB_THREADS; i++) { |
| 139 | pthread_join(threads[i], NULL); | 139 | thread_join(threads[i]); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | lockdownd_client_free(client); | 142 | lockdownd_client_free(client); |
