mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-04-04 13:02:01 +02:00
startup: Add spinloop until daemon is ready
This commit is contained in:
parent
6a605f1d08
commit
918bf9c70a
|
@ -1 +1 @@
|
|||
flake-profile-10-link
|
||||
flake-profile-11-link
|
|
@ -1 +0,0 @@
|
|||
/nix/store/q1w89c69h80a7vwlbqnsa396203k6hff-nix-shell-env
|
1
.direnv/flake-profile-11-link
Symbolic link
1
.direnv/flake-profile-11-link
Symbolic link
|
@ -0,0 +1 @@
|
|||
/nix/store/51yb1yhqssknlmxvvscvj0cqbvs0z915-nix-shell-env
|
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -926,9 +926,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "re_set-lib"
|
||||
version = "5.2.1"
|
||||
version = "5.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01fb110dc5087cdb0d8df799c3855c13e4ecb41f987e9691bf3d101c2dad1b3a"
|
||||
checksum = "77b4e5846cc4e5f6c51b60b16c2d51f282b5c407238b2e7077f6a0352b65d6cf"
|
||||
dependencies = [
|
||||
"dbus",
|
||||
"dbus-crossroads",
|
||||
|
@ -968,9 +968,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "reset_daemon"
|
||||
version = "1.5.0"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e555b347b8b0b67081aeb570096338eae68a8db4b877661254ce17c59e5134dd"
|
||||
checksum = "8cf329c1f14918f24d8d8f1674a16f5103208682f97b5d2bf1621b09c563c9cb"
|
||||
dependencies = [
|
||||
"crossbeam",
|
||||
"dbus",
|
||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/Xetibo/ReSet"
|
|||
license = "GPL-3.0-or-later"
|
||||
|
||||
[dependencies]
|
||||
reset_daemon = "1.5.0"
|
||||
reset_daemon = "2.1.0"
|
||||
re_set-lib = "5.2.1"
|
||||
# re_set-lib = { git = "https://github.com/Xetibo/ReSet-Lib" }
|
||||
adw = { version = "0.6.0", package = "libadwaita", features = ["v1_4"] }
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
# (rust-bin.selectLatestNightlyWith
|
||||
# (toolchain: toolchain.default))
|
||||
rust-bin.nightly."2024-05-10".default
|
||||
rust-analyzer
|
||||
clippy
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
use std::hint::{self};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
|
@ -71,8 +74,12 @@ async fn daemon_check() {
|
|||
let res: Result<(), Error> = proxy.method_call(BASE, "RegisterClient", ("ReSet",));
|
||||
res
|
||||
});
|
||||
let ready = Arc::new(AtomicBool::new(false));
|
||||
let res = handle.join();
|
||||
if res.unwrap().is_err() {
|
||||
run_daemon().await;
|
||||
run_daemon(Some(ready.clone())).await;
|
||||
}
|
||||
while !ready.load(std::sync::atomic::Ordering::SeqCst) {
|
||||
hint::spin_loop();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue