void CheckNextSponsor() { if (_renewingSponsors.Count == 0) { _currentState = LeaseState.Expired; _renewingSponsors = null; return; } ISponsor nextSponsor = (ISponsor)_renewingSponsors.Peek(); _renewalDelegate = new RenewalDelegate(nextSponsor.Renewal); IAsyncResult ar = _renewalDelegate.BeginInvoke(this, null, null); ThreadPool.RegisterWaitForSingleObject(ar.AsyncWaitHandle, new WaitOrTimerCallback(ProcessSponsorResponse), ar, _sponsorshipTimeout, true); }
void CheckNextSponsor () { if (_renewingSponsors.Count == 0) { _currentState = LeaseState.Expired; _renewingSponsors = null; return; } ISponsor nextSponsor = (ISponsor) _renewingSponsors.Peek(); _renewalDelegate = new RenewalDelegate (nextSponsor.Renewal); IAsyncResult ar = _renewalDelegate.BeginInvoke (this, null, null); ThreadPool.RegisterWaitForSingleObject (ar.AsyncWaitHandle, new WaitOrTimerCallback (ProcessSponsorResponse), ar, _sponsorshipTimeout, true); }