@@ -1,12 +1,15 @@
|
|
1 |
procedure main()
|
|
|
2 |
create_thread(thread_a)
|
3 |
create_thread(thread_b)
|
4 |
end procedure
|
5 |
|
6 |
procedure thread_a()
|
7 |
statement a1
|
|
|
8 |
end procedure
|
9 |
|
10 |
procedure thread_b()
|
|
|
11 |
statement b1
|
12 |
end procedure
|
1 |
procedure main()
|
2 |
+
shared a1_ready := create_semaphore(0) // can_run_b1
|
3 |
create_thread(thread_a)
|
4 |
create_thread(thread_b)
|
5 |
end procedure
|
6 |
|
7 |
procedure thread_a()
|
8 |
statement a1
|
9 |
+
signal(a1_ready)
|
10 |
end procedure
|
11 |
|
12 |
procedure thread_b()
|
13 |
+
wait(a1_ready)
|
14 |
statement b1
|
15 |
end procedure
|