{ Enforcing a mutual exclusion }

var
  MyTurn: integer;
  EC: TEventCount;
  S: TSequencer; { assume already created appropriately }

begin
  MyTurn := S.Ticket;
  EC.Await(MyTurn);
    {  Critical operations }
  EC.Advance;
end;