dont eat all the cpu

This commit is contained in:
Robin Appelman 2020-04-11 15:03:46 +02:00
commit 3307be701d
2 changed files with 4 additions and 1 deletions

View file

@ -6,7 +6,7 @@ Description=shortcutd
ProtectControlGroups=true
ProtectHome=true
ProtectKernelTunables=true
ProtectSystem=full
ProtectSystem=strict
RestrictSUIDSGID=true
PrivateNetwork=true
CapabilityBoundingSet=true

View file

@ -7,6 +7,7 @@ use std::fmt::{self, Display};
use std::str::FromStr;
use std::sync::mpsc::{channel, Receiver};
use std::sync::{Arc, Mutex};
use std::time::Duration;
mod keycodes;
@ -219,6 +220,8 @@ impl ShortcutListener {
tx.send(shortcut.clone()).unwrap()
}
}
} else {
std::thread::sleep(Duration::from_millis(10));
}
}
});