pub fn cycle(&mut self) {
		// Implementation note:
		//  The scopes here are set up so that we are only
		//  holding at most one lock at any given time. If
		//  we hold both then we would deadlock if a future
		//  calls Waker::wake() while it's being polled.

		let (mut to_awaken, new_tasks) = {
			let mut queue = self.queue.lock().unwrap();
			(
				std::mem::replace(&mut queue.to_wake, vec![]),
				std::mem::replace(&mut queue.tasks, vec![]),
			)
		};

		{
			let mut inner = self.inner.lock().unwrap();

			for (id, task) in new_tasks {
				inner.start_task(id, task);
			}

			inner.poll_all(&to_awaken, &self.queue);
		}

		to_awaken.clear();
		// Put back the original vector. If nothing signalled
		// that it should be polled then this will save an
		// allocation
		let mut queue = self.queue.lock().unwrap();
		std::mem::swap(&mut to_awaken, &mut queue.to_wake);
		// However, if something did request to be polled then
		// we still need to put it in the \queue
		queue.to_wake.extend_from_slice(&to_awaken);
	}
/// Poll all futures which have requested to be so polled
Poll all futures which have requested to be so polled
Poll all futures which have requested to be so polled
pub fn cycle(&mut self) {
		// Implementation note:
		//  The scopes here are set up so that we are only
		//  holding at most one lock at any given time. If
		//  we hold both then we would deadlock if a future
		//  calls Waker::wake() while it's being polled.
		let (mut to_awaken, new_tasks) = {
			let mut queue = self.queue.lock().unwrap();
			(
				std::mem::replace(&mut queue.to_wake, vec![]),
				std::mem::replace(&mut queue.tasks, vec![]),
			)
		};
		{
			let mut inner = self.inner.lock().unwrap();
			for (id, task) in new_tasks {
				inner.start_task(id, task);
			}
			inner.poll_all(&to_awaken, &self.queue);
		}
		to_awaken.clear();
		// Put back the original vector. If nothing signalled
		// that it should be polled then this will save an
		// allocation
		let mut queue = self.queue.lock().unwrap();
		std::mem::swap(&mut to_awaken, &mut queue.to_wake);
		// However, if something did request to be polled then
		// we still need to put it in the \queue
		queue.to_wake.extend_from_slice(&to_awaken);
	}
pub fn cycle ( & mut self ) { // Implementation note: //  The scopes here are set up so that we are only //  holding at most one lock at any given time. If //  we hold both then we would deadlock if a future //  calls Waker::wake() while it's being polled. let ( mut to_awaken , new_tasks ) = { let mut queue = self . queue . lock ( ) . unwrap ( ) ; ( std :: mem :: replace ( & mut queue . to_wake , vec ! [ ] ) , std :: mem :: replace ( & mut queue . tasks , vec ! [ ] ) , ) } ; { let mut inner = self . inner . lock ( ) . unwrap ( ) ; for ( id , task ) in new_tasks { inner . start_task ( id , task ) ; } inner . poll_all ( & to_awaken , & self . queue ) ; } to_awaken . clear ( ) ; // Put back the original vector. If nothing signalled // that it should be polled then this will save an // allocation let mut queue = self . queue . lock ( ) . unwrap ( ) ; std :: mem :: swap ( & mut to_awaken , & mut queue . to_wake ) ; // However, if something did request to be polled then // we still need to put it in the \queue queue . to_wake . extend_from_slice ( & to_awaken ) ; }
Poll all futures which have requested to be so polled
Poll all futures which have requested to be so polled
&mut self
&mut self