This commit is contained in:
Evan Feenstra
2023-06-02 14:38:10 -07:00
parent 17e5b9eb9f
commit 2b1933534d

View File

@@ -140,17 +140,15 @@ impl<C: 'static + Client> SignerLoop<C> {
} }
fn handle_message(&mut self, message: Vec<u8>, catch_init: bool) -> Result<Vec<u8>> { fn handle_message(&mut self, message: Vec<u8>, catch_init: bool) -> Result<Vec<u8>> {
// let l = self.lock.lock().unwrap(); // wait until not busy
loop { loop {
let is_busy = self.busy.load(Ordering::Relaxed); match self
if !is_busy { .busy
// busy now! .compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed)
self.busy.store(true, Ordering::Relaxed); {
break; Ok(_) => break,
} else { Err(_) => thread::sleep(Duration::from_millis(5)),
// wait 5 ms };
thread::sleep(Duration::from_millis(5));
}
} }
let dbid = self.client_id.as_ref().map(|c| c.dbid).unwrap_or(0); let dbid = self.client_id.as_ref().map(|c| c.dbid).unwrap_or(0);