procedure main()
shared a1_ready := create_semaphore(0)
shared b1_ready := create_semaphore(0)
create_thread(thread_a)
create_thread(thread_b)
end procedure
procedure thread_a()
statement a1
wait(b1_ready)
signal(a1_ready)
statement a2
end procedure
procedure thread_b()
statement b1
wait(a1_ready)
signal(b1_ready)
statement b2
end procedure