// Deadlock: bloqueo mutuo
shared a1_ready := semaphore(0)
shared b1_ready := semaphore(0)
main:
create_thread(thread_a, 1)
create_thread(thread_b, 1)
thread_a:
statement a1
wait(b1_ready);
signal(a1_ready);
statement a2
thread_b:
statement b1
wait(a1_ready);
signal(b1_ready);
statement b2