public void Leave(AgentClass agent) { semaphore.Release(); lock (agents) { agents.Remove(agent); } }
public void Enter(AgentClass agent) { semaphore.WaitOne(); lock (agents) { agents.Add(agent); } }