1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
shared can_a_continue := semaphore(0)
shared can_b_continue := semaphore(0)
main:
create_thread(thread_a, 1)
create_thread(thread_b, 1)
thread_a:
statement a1
signal(can_b_continue);
wait(can_a_continue);
statement a2
thread_b:
statement b1
signal(can_a_continue);
wait(can_b_continue);
statement b2