Remove parking_lot dependency (#846)
The standard library is using a similar implementation to parking_lot now. Other than APIs that are unstable, there shouldn't be that much of a reason to rely on parking_lot anymore. Parts of the cpal codebase already are using std locks. This PR removes the remaining parking_lot uses and replaces them with the standard library's.
This commit is contained in:
parent
4eec3e3441
commit
bdbbf75d82
8 changed files with 19 additions and 29 deletions
|
|
@ -1,8 +1,7 @@
|
|||
use super::alsa;
|
||||
use super::parking_lot::Mutex;
|
||||
use super::{Device, DeviceHandles};
|
||||
use crate::{BackendSpecificError, DevicesError};
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
/// ALSA's implementation for `Devices`.
|
||||
pub struct Devices {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
extern crate alsa;
|
||||
extern crate libc;
|
||||
extern crate parking_lot;
|
||||
|
||||
use self::alsa::poll::Descriptors;
|
||||
use self::parking_lot::Mutex;
|
||||
use crate::traits::{DeviceTrait, HostTrait, StreamTrait};
|
||||
use crate::{
|
||||
BackendSpecificError, BufferSize, BuildStreamError, ChannelCount, Data,
|
||||
|
|
@ -14,7 +12,7 @@ use crate::{
|
|||
};
|
||||
use std::cmp;
|
||||
use std::convert::TryInto;
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::thread::{self, JoinHandle};
|
||||
use std::time::Duration;
|
||||
use std::vec::IntoIter as VecIntoIter;
|
||||
|
|
@ -252,6 +250,7 @@ impl Device {
|
|||
let handle_result = self
|
||||
.handles
|
||||
.lock()
|
||||
.unwrap()
|
||||
.take(&self.name, stream_type)
|
||||
.map_err(|e| (e, e.errno()));
|
||||
|
||||
|
|
@ -311,7 +310,7 @@ impl Device {
|
|||
&self,
|
||||
stream_t: alsa::Direction,
|
||||
) -> Result<VecIntoIter<SupportedStreamConfigRange>, SupportedStreamConfigsError> {
|
||||
let mut guard = self.handles.lock();
|
||||
let mut guard = self.handles.lock().unwrap();
|
||||
let handle_result = guard
|
||||
.get_mut(&self.name, stream_t)
|
||||
.map_err(|e| (e, e.errno()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue