From 38e504515b44d0e359a3f02cfe49bb2ab995b25e Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Fri, 20 Dec 2019 19:02:33 +0200 Subject: [PATCH] rba-sdl2: Trying spin_sleep crate Former-commit-id: 1c6a36a1a61be3949080a8c86915235aaf25d0e5 --- Cargo.toml | 1 + src/plat/sdl2/main.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2cb4e62..de909e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ bitflags = "1.1.0" zip = "0.5.3" ctrlc = "3.1.3" cpal="0.10.0" +spin_sleep="0.3.7" [[bin]] name = "rba-sdl2" diff --git a/src/plat/sdl2/main.rs b/src/plat/sdl2/main.rs index fc77714..547ffa3 100644 --- a/src/plat/sdl2/main.rs +++ b/src/plat/sdl2/main.rs @@ -2,6 +2,8 @@ extern crate sdl2; use sdl2::event::Event; use sdl2::keyboard::Keycode; +extern crate spin_sleep; + use std::cell::RefCell; use std::rc::Rc; @@ -115,7 +117,7 @@ fn main() { match delay { None => {} Some(delay) => { - ::std::thread::sleep(delay); + spin_sleep::sleep(delay); } }; }