Skip to content

Commit

Permalink
Remove Sync requirement from ProcessHandler. (RustAudio#121)
Browse files Browse the repository at this point in the history
This partially reverts 356aec6.
  • Loading branch information
Windfisch committed Jun 25, 2020
1 parent 41fab12 commit 81f13df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/client/async_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct AsyncClient<N, P> {
impl<N, P> AsyncClient<N, P>
where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
/// Tell the JACK server that the program is ready to start processing audio. JACK will call the
/// methods specified by the `NotificationHandler` and `ProcessHandler` objects.
Expand Down
28 changes: 14 additions & 14 deletions src/client/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,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,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
ctx.notification.thread_init(&ctx.client)
Expand All @@ -167,7 +167,7 @@ unsafe extern "C" fn shutdown<N, P>(
data: *mut libc::c_void,
) where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
let cstr = ffi::CStr::from_ptr(reason);
Expand All @@ -184,7 +184,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,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
let scope = ProcessScope::from_raw(n_frames, ctx.client.raw());
Expand All @@ -194,7 +194,7 @@ where
unsafe extern "C" fn freewheel<N, P>(starting: libc::c_int, data: *mut libc::c_void)
where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
let is_starting = match starting {
Expand All @@ -207,7 +207,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,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
ctx.notification.buffer_size(&ctx.client, n_frames).to_ffi()
Expand All @@ -216,7 +216,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,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
ctx.notification.sample_rate(&ctx.client, n_frames).to_ffi()
Expand All @@ -228,7 +228,7 @@ unsafe extern "C" fn client_registration<N, P>(
data: *mut libc::c_void,
) where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
let name = ffi::CStr::from_ptr(name).to_str().unwrap();
Expand All @@ -246,7 +246,7 @@ unsafe extern "C" fn port_registration<N, P>(
data: *mut libc::c_void,
) where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
let register = match register {
Expand All @@ -266,7 +266,7 @@ unsafe extern "C" fn port_rename<N, P>(
) -> libc::c_int
where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
let old_name = ffi::CStr::from_ptr(old_name).to_str().unwrap();
Expand All @@ -283,7 +283,7 @@ unsafe extern "C" fn port_connect<N, P>(
data: *mut libc::c_void,
) where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
let are_connected = match connect {
Expand All @@ -297,7 +297,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,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
ctx.notification.graph_reorder(&ctx.client).to_ffi()
Expand All @@ -306,7 +306,7 @@ where
unsafe extern "C" fn xrun<N, P>(data: *mut libc::c_void) -> libc::c_int
where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
ctx.notification.xrun(&ctx.client).to_ffi()
Expand All @@ -315,7 +315,7 @@ where
unsafe extern "C" fn latency<N, P>(mode: j::jack_latency_callback_mode_t, data: *mut libc::c_void)
where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
let ctx = CallbackContext::<N, P>::from_raw(data);
let mode = match mode {
Expand Down Expand Up @@ -354,7 +354,7 @@ pub struct CallbackContext<N, P> {
impl<N, P> CallbackContext<N, P>
where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + Sync + ProcessHandler,
P: 'static + Send + ProcessHandler,
{
pub unsafe fn from_raw<'a>(ptr: *mut libc::c_void) -> &'a mut CallbackContext<N, P> {
debug_assert!(!ptr.is_null());
Expand Down

0 comments on commit 81f13df

Please sign in to comment.