]>
git.saurik.com Git - apple/libdispatch.git/blob - testing/test.c
2 #include <mach/mach_time.h>
12 void (^wb
)(dispatch_item_t
) = ^(dispatch_item_t di
) {
13 printf("%p\t%p\t%s:\t%llu\n", pthread_self(), di
, __func__
, mach_absolute_time());
15 void (^cb
)(dispatch_item_t
) = ^(dispatch_item_t di
) {
16 printf("%p\t%p\t%s:\t%llu\n", pthread_self(), di
, __func__
, mach_absolute_time());
23 q
= dispatch_queue_new("test", 0, NULL
, NULL
, NULL
);
26 for (i
= 0; i
< 1000; i
++) {
27 r
= dispatch_call_wait(q
, wb
, NULL
);
31 printf("done with dispatch_call_wait()\n");
33 r
= dispatch_apply_wait(wb
, 10, NULL
);
36 r
= dispatch_call(q
, wb
, cb
, NULL
, &di_r
);
40 printf("waiting for dispatch_call() callback\n");