Closed james7132 closed 2 years ago
Doesn't park()
add spurious wakeups, which parking
avoids? I don't know, I'm still waiting on an answer for smol-rs/parking#7
AFAIU the reason for using parking
is not to avoid spurious wakeups but to prevent the risk of deadlock when the future also makes use of park/unpark.
See this issue: https://github.com/rust-lang/futures-rs/pull/2010
Yeah, the use of parking
should be correct here. Also, parking
is enough small and I don't think it would cause an increase in compile time in practice. (Try building with the --timings flag.)
parking
adds extra compile time for something that's already available in the std lib. This PR replacesparking
withstd::thread::park
andThread::unpark
when usingfuture::block_on
. It has also gotten signfigant platform-specific improvements thatparking
lacks. This might add one additional thread local lookup when the thread is parked, but if you're parking the thread anyway, I don't think that overhead really matters.