Skip to content

Commit

Permalink
Driver: Remove spin_sleep in Mixer::march_deadline (#124)
Browse files Browse the repository at this point in the history
* Remove spin_sleep

* Remove comment
  • Loading branch information
GnomedDev authored and FelixMcFelix committed Jul 22, 2022
1 parent 98f0d02 commit e3476e7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ features = ["voice", "gateway"]
optional = true
version = "0.1"

[dependencies.spin_sleep]
optional = true
version = "1"

[dependencies.streamcatcher]
optional = true
version = "1"
Expand Down Expand Up @@ -161,7 +157,6 @@ driver-core = [
"parking_lot",
"rand",
"serenity-voice-model",
"spin_sleep",
"streamcatcher",
"typemap_rev",
"url",
Expand Down
7 changes: 1 addition & 6 deletions src/driver/tasks/mixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use discortp::{
};
use flume::{Receiver, Sender, TryRecvError};
use rand::random;
use spin_sleep::SpinSleeper;
use std::time::Instant;
use tokio::runtime::Handle;
use tracing::{debug, error, instrument};
Expand All @@ -38,7 +37,6 @@ pub struct Mixer {
pub prevent_events: bool,
pub silence_frames: u8,
pub skip_sleep: bool,
pub sleeper: SpinSleeper,
pub soft_clip: SoftClip,
pub tracks: Vec<Track>,
pub ws: Option<Sender<WsMessage>>,
Expand Down Expand Up @@ -95,7 +93,6 @@ impl Mixer {
prevent_events: false,
silence_frames: 0,
skip_sleep: false,
sleeper: Default::default(),
soft_clip,
tracks,
ws: None,
Expand Down Expand Up @@ -402,9 +399,7 @@ impl Mixer {
return;
}

// FIXME: make choice of spin-sleep/imprecise sleep optional in next breaking.
self.sleeper
.sleep(self.deadline.saturating_duration_since(Instant::now()));
std::thread::sleep(self.deadline.saturating_duration_since(Instant::now()));
self.deadline += TIMESTEP_LENGTH;
}

Expand Down

0 comments on commit e3476e7

Please sign in to comment.