]> git.ozlabs.org Git - ccan/blob - ccan/antithread/test/run-tell.c
Use -O not -O3: reduces ccan/tdb test time from 24 to 18 seconds.
[ccan] / ccan / antithread / test / run-tell.c
1 #include "antithread/antithread.c"
2 #include <assert.h>
3 #include "tap/tap.h"
4
5 static void *test(struct at_pool *atp, void *unused)
6 {
7         char *p;
8         p = at_read_parent(atp);
9         at_tell_parent(atp, p + 1);
10         return NULL;
11 };
12
13 int main(int argc, char *argv[])
14 {
15         struct at_pool *atp;
16         struct athread *at;
17
18         plan_tests(1);
19
20         atp = at_pool(1*1024*1024);
21         assert(atp);
22         at = at_run(atp, test, NULL);
23         assert(at);
24
25         at_tell(at, argv[0]);
26         ok1(at_read(at) == argv[0] + 1);
27         talloc_free(at);
28
29         return exit_status();
30 }