From f97631e36320219e014332d1317551e23cfc1bd2 Mon Sep 17 00:00:00 2001
From: Billy Messenger <BillyDM@tutamail.com>
Date: Sat, 19 Feb 2022 10:35:21 -0600
Subject: [PATCH 1/3] remove Sync requirement from NotificationHandler

---
 Cargo.toml                 |  2 +-
 src/client/async_client.rs |  2 +-
 src/client/callbacks.rs    | 26 +++++++++++++-------------
 src/client/client_impl.rs  |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

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/src/client/async_client.rs b/src/client/async_client.rs
index 05593c36..d9a37eae 100644
--- a/src/client/async_client.rs
+++ b/src/client/async_client.rs
@@ -43,7 +43,7 @@ unsafe impl<N, P> Sync for AsyncClient<N, P> {}
 
 impl<N, P> AsyncClient<N, P>
 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..937a7dbe 100644
--- a/src/client/callbacks.rs
+++ b/src/client/callbacks.rs
@@ -104,7 +104,7 @@ pub trait ProcessHandler: Send {
 
 unsafe extern "C" fn thread_init_callback<N, P>(data: *mut libc::c_void)
 where
-    N: 'static + Send + Sync + NotificationHandler,
+    N: 'static + Send + NotificationHandler,
     P: 'static + Send + ProcessHandler,
 {
     let ctx = CallbackContext::<N, P>::from_raw(data);
@@ -116,7 +116,7 @@ unsafe extern "C" fn shutdown<N, P>(
     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::<N, P>::from_raw(data);
@@ -130,7 +130,7 @@ unsafe extern "C" fn shutdown<N, P>(
 
 unsafe extern "C" fn process<N, P>(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::<N, P>::from_raw(data);
@@ -140,7 +140,7 @@ where
 
 unsafe extern "C" fn freewheel<N, P>(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::<N, P>::from_raw(data);
@@ -150,7 +150,7 @@ where
 
 unsafe extern "C" fn buffer_size<N, P>(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::<N, P>::from_raw(data);
@@ -159,7 +159,7 @@ where
 
 unsafe extern "C" fn sample_rate<N, P>(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::<N, P>::from_raw(data);
@@ -171,7 +171,7 @@ unsafe extern "C" fn client_registration<N, P>(
     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::<N, P>::from_raw(data);
@@ -186,7 +186,7 @@ unsafe extern "C" fn port_registration<N, P>(
     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::<N, P>::from_raw(data);
@@ -203,7 +203,7 @@ unsafe extern "C" fn port_rename<N, P>(
     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::<N, P>::from_raw(data);
@@ -220,7 +220,7 @@ unsafe extern "C" fn port_connect<N, P>(
     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::<N, P>::from_raw(data);
@@ -231,7 +231,7 @@ unsafe extern "C" fn port_connect<N, P>(
 
 unsafe extern "C" fn graph_order<N, P>(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::<N, P>::from_raw(data);
@@ -240,7 +240,7 @@ where
 
 unsafe extern "C" fn xrun<N, P>(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::<N, P>::from_raw(data);
@@ -274,7 +274,7 @@ pub struct CallbackContext<N, P> {
 
 impl<N, P> CallbackContext<N, P>
 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<N, P> {
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<AsyncClient<N, P>, Error>
     where
-        N: 'static + Send + Sync + NotificationHandler,
+        N: 'static + Send + NotificationHandler,
         P: 'static + Send + ProcessHandler,
     {
         AsyncClient::new(self, notification_handler, process_handler)

From f025c1655770a249141a1d54d7dc926238091c61 Mon Sep 17 00:00:00 2001
From: Billy Messenger <BillyDM@tutamail.com>
Date: Sat, 19 Feb 2022 11:27:12 -0600
Subject: [PATCH 2/3] remove Sync impl from AsyncClient

---
 src/client/async_client.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/client/async_client.rs b/src/client/async_client.rs
index d9a37eae..c3ac9782 100644
--- a/src/client/async_client.rs
+++ b/src/client/async_client.rs
@@ -39,7 +39,7 @@ pub struct AsyncClient<N, P> {
 }
 
 unsafe impl<N, P> Send for AsyncClient<N, P> {}
-unsafe impl<N, P> Sync for AsyncClient<N, P> {}
+//unsafe impl<N, P> Sync for AsyncClient<N, P> {}
 
 impl<N, P> AsyncClient<N, P>
 where

From d632cbf998559cf14cf0dfe75077ea13f212e3c3 Mon Sep 17 00:00:00 2001
From: Billy Messenger <BillyDM@tutamail.com>
Date: Sat, 19 Feb 2022 11:46:52 -0600
Subject: [PATCH 3/3] make self in NotificationHandler::thread_init mutable

---
 examples/playback_capture.rs | 2 +-
 src/client/callbacks.rs      | 2 +-
 src/client/test_callback.rs  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

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/callbacks.rs b/src/client/callbacks.rs
index 937a7dbe..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
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);
     }