Download pseudo source code

procedure main()
  shared a1_ready := create_semaphore(0) // can_run_b1
  create_thread(thread_a)
  create_thread(thread_b)
end procedure

procedure thread_a()
  statement a1
  signal(a1_ready)
end procedure

procedure thread_b()
  wait(a1_ready)
  statement b1
end procedure