dbus: Use ThreadPool instead of zbus blocking API

The `zbus` blocking API just wraps the async API with `block_on`, so we
may as well use our own executor.
This commit is contained in:
Ian Douglas Scott 2025-06-17 17:50:30 -07:00 committed by Ian Douglas Scott
parent 8455869439
commit 55401b1e53
5 changed files with 26 additions and 29 deletions

View file

@ -18,7 +18,7 @@
//!
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
use zbus::blocking::Connection;
use zbus::Connection;
#[zbus::proxy(
interface = "com.system76.PowerDaemon",
@ -79,9 +79,9 @@ pub trait PowerDaemon {
fn power_profile_switch(&self, profile: &str) -> zbus::Result<()>;
}
pub fn init() -> anyhow::Result<PowerDaemonProxyBlocking<'static>> {
let conn = Connection::system()?;
let proxy = PowerDaemonProxyBlocking::new(&conn)?;
proxy.0.introspect()?;
pub async fn init() -> anyhow::Result<PowerDaemonProxy<'static>> {
let conn = Connection::system().await?;
let proxy = PowerDaemonProxy::new(&conn).await?;
proxy.0.introspect().await?;
Ok(proxy)
}