add SeqWait

SeqWait adds a way to .await the arrival of some sequence number.
It provides wait_for(num) which is an async fn, and advance(num) which
is synchronous.

This should be useful in solving the page cache deadlocks, and may be
useful in other areas too.

This implementation still uses a Mutex internally, but only for a brief
critical section. If we find this code broadly useful and start to care
more about executor stalls due to unfair thread scheduling, there might
be ways to make it lock-free.
This commit is contained in:
Eric Seppanen
2021-04-20 11:40:45 -07:00
parent 1f3f4cfaf5
commit 8060e17b50
4 changed files with 211 additions and 0 deletions

View File

@@ -1,2 +1,4 @@
//! zenith_utils is intended to be a place to put code that is shared
//! between other crates in this repository.
pub mod seqwait;