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(); }
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(); } }