replace top level mutex with rw lock

This commit is contained in:
🪞👃🪞 2024-07-05 20:02:55 +03:00
parent 33de8bbf1d
commit 2989c79fd0
5 changed files with 21 additions and 15 deletions

View file

@ -43,7 +43,7 @@ pub use ::_jack::{
};
/// Just run thing with JACK. Returns the activated client.
pub fn jack_run <T> (name: &str, app: &Arc<Mutex<T>>) -> Usually<DynamicAsyncClient>
pub fn jack_run <T: Sync> (name: &str, app: &Arc<RwLock<T>>) -> Usually<DynamicAsyncClient>
where T: Handle + Process + Send + 'static
{
let options = ClientOptions::NO_START_SERVER;
@ -59,7 +59,7 @@ pub fn jack_run <T> (name: &str, app: &Arc<Mutex<T>>) -> Usually<DynamicAsyncCli
ClosureProcessHandler::new(Box::new({
let app = app.clone();
move|c: &Client, s: &ProcessScope|{
app.lock().unwrap().process(c, s)
app.write().unwrap().process(c, s)
//Control::Continue
}
}) as BoxedProcessHandler)