Download pseudo source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
procedure main()
  input const skater_count, const room_capacity
  shared can_skate := create_semaphore(room_capacity)
  create_threads(skater_count, skater)
end procedure

procedure skater()
  // Concurrency-bounded region
  wait(can_skate)
  skate()
  signal(can_skate)
end procedure