Bakery algorithm in Erlang