Closed RobWalt closed 2 years ago
I had a look at the code snippet you are referring to and it looks correct to me. Additionally, Waker
is not a Future
. The thing we are calling unwrap
on is the Result<MutexGuard<Waker>, PoisonError>
that the lock
method returns.
Ok, sorry I just found my error. I was using tokio::sync::Mutex
on accident. Thanks for your quick reply, I'm going to close this.
In one of the last sections called "A few loose ends" the importance of updating the waker on every poll call is explained.
To solve the updating challenge, the following is proposed:
where
Waker
meansstd::task::Waker
. Later in that code we repeatingly call:However, at the time of creation of this issue, the
std::task::Waker
seems to be aFuture
instead of anOption
or aResult
. This completely breaks this sections code. If we would try to resolve this by callingawait
on these futures in all cases (I don't really know if that makes sense at that point anyway) it doesn't work, since we do this in a synchronous function.