mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
jack device mutex -> rwlock
This commit is contained in:
parent
52ea78a466
commit
33de8bbf1d
4 changed files with 17 additions and 13 deletions
|
|
@ -53,17 +53,17 @@ impl Track {
|
|||
device: 0,
|
||||
})
|
||||
}
|
||||
pub fn device (&self) -> Option<MutexGuard<Box<dyn Device>>> {
|
||||
pub fn device (&self) -> Option<RwLockReadGuard<Box<dyn Device>>> {
|
||||
self.get_device(self.device)
|
||||
}
|
||||
pub fn first_device (&self) -> Option<MutexGuard<Box<dyn Device>>> {
|
||||
pub fn first_device (&self) -> Option<RwLockReadGuard<Box<dyn Device>>> {
|
||||
self.get_device(0)
|
||||
}
|
||||
pub fn last_device (&self) -> Option<MutexGuard<Box<dyn Device>>> {
|
||||
pub fn last_device (&self) -> Option<RwLockReadGuard<Box<dyn Device>>> {
|
||||
self.get_device(self.devices.len().saturating_sub(1))
|
||||
}
|
||||
pub fn get_device (&self, i: usize) -> Option<MutexGuard<Box<dyn Device>>> {
|
||||
self.devices.get(i).map(|d|d.state.lock().unwrap())
|
||||
pub fn get_device (&self, i: usize) -> Option<RwLockReadGuard<Box<dyn Device>>> {
|
||||
self.devices.get(i).map(|d|d.state.read().unwrap())
|
||||
}
|
||||
pub fn add_device (&mut self, device: JackDevice) -> Usually<&mut JackDevice> {
|
||||
self.devices.push(device);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue