Exemple #1
0
 public void Leave(AgentClass agent)
 {
     semaphore.Release();
     lock (agents)
     {
         agents.Remove(agent);
     }
 }
Exemple #2
0
 public void Enter(AgentClass agent)
 {
     semaphore.WaitOne();
     lock (agents)
     {
         agents.Add(agent);
     }
 }