first pass at xpc impl
This commit is contained in:
@@ -3,6 +3,9 @@ mod daemon;
|
||||
#[cfg(target_os = "linux")]
|
||||
mod dbus;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod xpc;
|
||||
|
||||
use log::LevelFilter;
|
||||
use std::future;
|
||||
|
||||
@@ -33,7 +36,16 @@ async fn start_ipc_agent(daemon: &mut Daemon) {
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
async fn start_ipc_agent(daemon: &mut Daemon) {
|
||||
// TODO: Implement macOS IPC agent.
|
||||
// Start the macOS XPC agent (events in, signals out) on a dedicated thread.
|
||||
let agent = xpc::agent::XpcAgent::new(daemon.event_sender.clone(), daemon.obtain_signal_receiver());
|
||||
std::thread::spawn(move || {
|
||||
// Use a single-threaded Tokio runtime for the XPC agent.
|
||||
let rt = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.expect("Unable to create tokio runtime for XPC agent");
|
||||
rt.block_on(agent.run());
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
|
||||
Reference in New Issue
Block a user