Home | History | Annotate | Download | only in tests

Lines Matching refs:shared

11 static volatile int shared[2];
41 shared[0] = 22;
42 shared[1] = 77;
44 pthread_create(&a, NULL, t1, (void *)&shared[0]);
45 // a steals shared[0] from root thread, so is excl(a)
46 pthread_create(&b, NULL, t2, (void *)&shared[1]);
47 // b steals shared[1] from root thread, so is excl(b)
50 // b's stuff (shared[1]) still belongs to b, so is excl(b)
52 // ret is excl(root), and shared[0] is re-acquired as excl(root)
55 ret += shared[0]; /* no error - a is finished */
57 // but shared[1] is excl(b); hence we're reading excl(b)
60 ret += shared[1]; /* expect error - b has not finished,
61 so we can't touch shared[1] yet */