From 37016e612c4eadd2cc8c4a8fb3a5bd4427a0a205 Mon Sep 17 00:00:00 2001 From: Andriy Symonovych Date: Wed, 6 Dec 2017 13:13:36 +0200 Subject: [PATCH] Fix macos build (#186) * fix compile error * fix missing function error * fix undefined behavior issue * require callback to be `Send` --- src/coreaudio/mod.rs | 6 +++--- src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreaudio/mod.rs b/src/coreaudio/mod.rs index 3263118..8c33151 100644 --- a/src/coreaudio/mod.rs +++ b/src/coreaudio/mod.rs @@ -65,7 +65,7 @@ pub struct EventLoop { struct ActiveCallbacks { // Whenever the `run()` method is called with a callback, this callback is put in this list. - callbacks: Mutex>, + callbacks: Mutex>, } struct VoiceInner { @@ -98,9 +98,9 @@ impl EventLoop { #[inline] pub fn run(&self, mut callback: F) -> ! - where F: FnMut(VoiceId, UnknownTypeBuffer) + where F: FnMut(VoiceId, UnknownTypeBuffer) + Send { - let callback: &mut FnMut(VoiceId, UnknownTypeBuffer) = &mut callback; + let callback: &mut (FnMut(VoiceId, UnknownTypeBuffer) + Send) = &mut callback; self.active_callbacks .callbacks .lock() diff --git a/src/lib.rs b/src/lib.rs index 4b72fc4..c134e96 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -374,7 +374,7 @@ impl EventLoop { /// You can call the other methods of `EventLoop` without getting a deadlock. #[inline] pub fn run(&self, mut callback: F) -> ! - where F: FnMut(VoiceId, UnknownTypeBuffer) + where F: FnMut(VoiceId, UnknownTypeBuffer) + Send { self.0.run(move |id, buf| callback(VoiceId(id), buf)) }