1 #include <ccan/antithread/antithread.c>
4 #include <ccan/tap/tap.h>
8 static void *test(struct at_pool *atp, int *val)
12 if (at_read_parent(atp) != test) {
13 diag("Woah, at_read said bad");
17 /* We increment val, then sleep a little. */
18 for (i = 0; i < NUM_RUNS; i++) {
20 (*(volatile int *)val)++;
29 int main(int argc, char *argv[])
37 atp = at_pool(1*1024*1024);
39 val = talloc_zero(at_pool_ctx(atp), int);
40 at = at_run(atp, test, val);
47 /* We increment val, then sleep a little. */
48 for (i = 0; i < NUM_RUNS; i++) {
50 (*(volatile int *)val)++;
55 ok1(at_read(at) == val);
58 ok1(*val == NUM_RUNS*2);