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