Skip to content

Commit

Permalink
Ignore clippy warning of Arc for non-Send type, add as TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
orottier committed Aug 28, 2023
1 parent 696a521 commit 504197a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/io/cpal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ use crate::{AtomicF64, MAX_CHANNELS};

use crossbeam_channel::Receiver;

// I doubt this construct is entirely safe. Stream is not Send/Sync (probably for a good reason) so
// it should be managed from a single thread instead.
// <https://github.com/orottier/web-audio-api-rs/issues/357>
mod private {
use super::*;

Expand All @@ -28,6 +31,7 @@ mod private {

impl ThreadSafeClosableStream {
pub fn new(stream: Stream) -> Self {
#[allow(clippy::arc_with_non_send_sync)]
Self(Arc::new(Mutex::new(Some(stream))))
}

Expand Down
4 changes: 4 additions & 0 deletions src/io/cubeb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ impl<F> CubebStream for Stream<F> {
}
}

// I doubt this construct is entirely safe. Stream is not Send/Sync (probably for a good reason) so
// it should be managed from a single thread instead.
// <https://github.com/orottier/web-audio-api-rs/issues/357>
mod private {
use super::*;
use std::sync::Mutex;
Expand All @@ -44,6 +47,7 @@ mod private {
impl ThreadSafeClosableStream {
pub fn new<F: 'static>(stream: Stream<F>) -> Self {
let boxed_stream = BoxedStream(Box::new(stream));
#[allow(clippy::arc_with_non_send_sync)]
Self(Arc::new(Mutex::new(Some(boxed_stream))))
}

Expand Down

0 comments on commit 504197a

Please sign in to comment.