Esempio n. 1
0
 protected override void GenerateTellers(IModel model)
 {
     TellerPool = new TellerPool(this);
     for (int i = 0; i < NTellers; i++)
     {
         TellerPool.Add(new TellerSynchronous(this, ServiceTime));
     }
 }
Esempio n. 2
0
 protected virtual void GenerateTellers(IModel model)
 {
     TellerPool = new TellerPool(this);
     for (int i = 0; i < NTellers; i++)
     {
         TellerPool.Add(new Teller(this, ServiceTime));
     }
 }
Esempio n. 3
0
            internal virtual void Start(TellerPool tellerPool)
            {
                TellerRequest tr = new TellerRequest();

                tellerPool.Acquire(tr, true); // Blocks until a teller is acquired.
                Teller teller = (Teller)tr.ResourceObtained;

                teller.DoService(this); // Blocks while the teller is servicing me.
                // Service is done.
                tr.Release();
            }
Esempio n. 4
0
 internal override void Start(TellerPool tellerPool)
 {
     m_tellerPool    = tellerPool;
     m_tellerRequest = new TellerRequest();
     if (!m_tellerPool.Acquire(m_tellerRequest, false))
     {
         m_tellerPool.ResourceReleased += TellerPoolOnResourceReleased;
         // We might use this, too, if we were adding and removing tellers dynamically.
         //m_tellerPool.ResourceAdded += TellerPoolOnResourceAdded;
     }
     else
     {
         StartService();
     }
 }