|
|
|
@ -64,7 +64,37 @@ impl Initialiser
|
|
|
|
|
rx,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn into_wait(self) -> impl Future<Output=Result<(), InitWaitError>> + 'static
|
|
|
|
|
{
|
|
|
|
|
let mut rx = self.rx;
|
|
|
|
|
async move {
|
|
|
|
|
if !*rx.borrow() {
|
|
|
|
|
while !rx.recv().await.ok_or_else(|| InitWaitError)? {
|
|
|
|
|
//tokio::task::yield_now().await;
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn clone_into_wait(&self) -> impl Future<Output=Result<(), InitWaitError>> + 'static
|
|
|
|
|
{
|
|
|
|
|
let mut rx = self.rx.clone();
|
|
|
|
|
async move {
|
|
|
|
|
if !*rx.borrow() {
|
|
|
|
|
while !rx.recv().await.ok_or_else(|| InitWaitError)? {
|
|
|
|
|
//tokio::task::yield_now().await;
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn wait(&mut self) -> Result<(), InitWaitError>
|
|
|
|
|
{
|
|
|
|
|
if !*self.rx.borrow() {
|
|
|
|
|