diff --git a/Cargo.toml b/Cargo.toml index 2f374305..79f8ef31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "jack" readme = "README.md" repository = "https://github.com/RustAudio/rust-jack" -version = "0.9.0" +version = "0.9.1" [dependencies] bitflags = "1" diff --git a/examples/playback_capture.rs b/examples/playback_capture.rs index e4f755ec..ec5d8ba5 100644 --- a/examples/playback_capture.rs +++ b/examples/playback_capture.rs @@ -46,7 +46,7 @@ fn main() { struct Notifications; impl jack::NotificationHandler for Notifications { - fn thread_init(&self, _: &jack::Client) { + fn thread_init(&mut self, _: &jack::Client) { println!("JACK: thread init"); } diff --git a/src/client/async_client.rs b/src/client/async_client.rs index 05593c36..c3ac9782 100644 --- a/src/client/async_client.rs +++ b/src/client/async_client.rs @@ -39,11 +39,11 @@ pub struct AsyncClient { } unsafe impl Send for AsyncClient {} -unsafe impl Sync for AsyncClient {} +//unsafe impl Sync for AsyncClient {} impl AsyncClient where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { /// Tell the JACK server that the program is ready to start processing audio. JACK will call the diff --git a/src/client/callbacks.rs b/src/client/callbacks.rs index ea060bc4..14e95d5b 100644 --- a/src/client/callbacks.rs +++ b/src/client/callbacks.rs @@ -14,7 +14,7 @@ pub trait NotificationHandler: Send { /// handled. /// /// It does not need to be suitable for real-time execution. - fn thread_init(&self, _: &Client) {} + fn thread_init(&mut self, _: &Client) {} /// Called when the JACK server shuts down the client thread. The function /// must be written as if @@ -104,7 +104,7 @@ pub trait ProcessHandler: Send { unsafe extern "C" fn thread_init_callback(data: *mut libc::c_void) where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -116,7 +116,7 @@ unsafe extern "C" fn shutdown( reason: *const libc::c_char, data: *mut libc::c_void, ) where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -130,7 +130,7 @@ unsafe extern "C" fn shutdown( unsafe extern "C" fn process(n_frames: Frames, data: *mut libc::c_void) -> libc::c_int where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -140,7 +140,7 @@ where unsafe extern "C" fn freewheel(starting: libc::c_int, data: *mut libc::c_void) where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -150,7 +150,7 @@ where unsafe extern "C" fn buffer_size(n_frames: Frames, data: *mut libc::c_void) -> libc::c_int where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -159,7 +159,7 @@ where unsafe extern "C" fn sample_rate(n_frames: Frames, data: *mut libc::c_void) -> libc::c_int where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -171,7 +171,7 @@ unsafe extern "C" fn client_registration( register: libc::c_int, data: *mut libc::c_void, ) where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -186,7 +186,7 @@ unsafe extern "C" fn port_registration( register: libc::c_int, data: *mut libc::c_void, ) where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -203,7 +203,7 @@ unsafe extern "C" fn port_rename( data: *mut libc::c_void, ) -> libc::c_int where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -220,7 +220,7 @@ unsafe extern "C" fn port_connect( connect: libc::c_int, data: *mut libc::c_void, ) where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -231,7 +231,7 @@ unsafe extern "C" fn port_connect( unsafe extern "C" fn graph_order(data: *mut libc::c_void) -> libc::c_int where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -240,7 +240,7 @@ where unsafe extern "C" fn xrun(data: *mut libc::c_void) -> libc::c_int where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { let ctx = CallbackContext::::from_raw(data); @@ -274,7 +274,7 @@ pub struct CallbackContext { impl CallbackContext where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { pub unsafe fn from_raw<'a>(ptr: *mut libc::c_void) -> &'a mut CallbackContext { diff --git a/src/client/client_impl.rs b/src/client/client_impl.rs index f667e93f..5a14240c 100644 --- a/src/client/client_impl.rs +++ b/src/client/client_impl.rs @@ -110,7 +110,7 @@ impl Client { process_handler: P, ) -> Result, Error> where - N: 'static + Send + Sync + NotificationHandler, + N: 'static + Send + NotificationHandler, P: 'static + Send + ProcessHandler, { AsyncClient::new(self, notification_handler, process_handler) diff --git a/src/client/test_callback.rs b/src/client/test_callback.rs index a626c049..48998fb3 100644 --- a/src/client/test_callback.rs +++ b/src/client/test_callback.rs @@ -23,7 +23,7 @@ pub struct Counter { } impl NotificationHandler for Counter { - fn thread_init(&self, _: &Client) { + fn thread_init(&mut self, _: &Client) { self.thread_init_count.fetch_add(1, Ordering::Relaxed); }