summaryrefslogtreecommitdiffstats
path: root/src/bin.rs
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2020-10-29 13:09:31 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2020-10-29 13:18:36 +0200
commit6392904047919a8f6f4a3bbae3d371037f840300 (patch)
treef3cbf494680bea77858725b7e5212896c4680d73 /src/bin.rs
parent57e6cf39809ca9436b8a592918e226c3fa3b1ed3 (diff)
Replace PosixTimer with async timers
Diffstat (limited to 'src/bin.rs')
-rw-r--r--src/bin.rs18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/bin.rs b/src/bin.rs
index b6fc61bc..bb22acb0 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -49,9 +49,6 @@ static GLOBAL: System = System;
extern crate melib;
use melib::*;
-mod unix;
-use unix::*;
-
#[macro_use]
pub mod types;
use crate::types::*;
@@ -104,7 +101,6 @@ fn notify(
nix::fcntl::FcntlArg::F_SETFL(nix::fcntl::OFlag::O_NONBLOCK),
);
std::thread::spawn(move || {
- let mut buf = [0; 1];
let mut ctr = 0;
loop {
ctr %= 3;
@@ -117,16 +113,6 @@ fn notify(
for signal in signals.pending() {
let _ = s.send_timeout(signal, Duration::from_millis(500)).ok();
}
- while nix::unistd::read(alarm_pipe_r, buf.as_mut())
- .map(|s| s > 0)
- .unwrap_or(false)
- {
- let value = buf[0];
- let _ = sender.send_timeout(
- ThreadEvent::UIEvent(UIEvent::Timer(value)),
- Duration::from_millis(2000),
- );
- }
std::thread::sleep(std::time::Duration::from_millis(100));
ctr += 1;
@@ -377,7 +363,9 @@ fn run_app(opt: Opt) -> Result<()> {
#[cfg(all(target_os = "linux", feature = "dbus-notifications"))]
{
- let dbus_notifications = Box::new(components::notifications::DbusNotifications::new());
+ let dbus_notifications = Box::new(components::notifications::DbusNotifications::new(
+ &state.context,
+ ));
state.register_component(dbus_notifications);
}
state.register_component(Box::new(