mutex: state_machine
var user : client_id init !;
waiting : list of client_id init !
acquire: command
if user !! " send OK to client;
user :! client
[] user #! " waiting :! waiting client
fi
end acquire
release: command
if waiting !! " user :! !
[] waiting #! " send OK to head(waiting );
user :! head(waiting );
waiting :! tail(waiting )
fi
end release
end mutex