mirror of
https://github.com/stakwork/sphinx-key.git
synced 2025-12-17 07:14:23 +01:00
feat/lss
This commit is contained in:
@@ -140,17 +140,15 @@ impl<C: 'static + Client> SignerLoop<C> {
|
||||
}
|
||||
|
||||
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 {
|
||||
let is_busy = self.busy.load(Ordering::Relaxed);
|
||||
if !is_busy {
|
||||
// busy now!
|
||||
self.busy.store(true, Ordering::Relaxed);
|
||||
break;
|
||||
} else {
|
||||
// wait 5 ms
|
||||
thread::sleep(Duration::from_millis(5));
|
||||
}
|
||||
match self
|
||||
.busy
|
||||
.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed)
|
||||
{
|
||||
Ok(_) => break,
|
||||
Err(_) => thread::sleep(Duration::from_millis(5)),
|
||||
};
|
||||
}
|
||||
|
||||
let dbid = self.client_id.as_ref().map(|c| c.dbid).unwrap_or(0);
|
||||
|
||||
Reference in New Issue
Block a user