mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-22 00:00:11 +02:00
Limit the scope of borrow_mut in consume_queue
Otherwise we may accidentally hold the borrowed ref cell for too long which can cause a borrow error. Closes #190
This commit is contained in:
+2
-1
@@ -411,7 +411,8 @@ impl Core {
|
||||
// TODO: can we do better than `.unwrap()` here?
|
||||
let unpark = self.rx_readiness.clone();
|
||||
loop {
|
||||
match self.rx.borrow_mut().poll_stream(unpark.clone()).unwrap() {
|
||||
let msg = self.rx.borrow_mut().poll_stream(unpark.clone()).unwrap();
|
||||
match msg {
|
||||
Async::Ready(Some(msg)) => self.notify(msg),
|
||||
Async::NotReady |
|
||||
Async::Ready(None) => break,
|
||||
|
||||
Reference in New Issue
Block a user