forked from mirrors/gstreamer-rs
gstreamer/clock: Move away from deprecated atomic API
This commit is contained in:
parent
a8eca0edb8
commit
faa6463bda
1 changed files with 14 additions and 6 deletions
|
@ -312,13 +312,21 @@ impl AtomicClockReturn {
|
|||
unsafe { from_glib(self.0.swap(val.to_glib(), atomic::Ordering::SeqCst)) }
|
||||
}
|
||||
|
||||
pub fn compare_and_swap(&self, current: ClockReturn, new: ClockReturn) -> ClockReturn {
|
||||
pub fn compare_exchange(
|
||||
&self,
|
||||
current: ClockReturn,
|
||||
new: ClockReturn,
|
||||
) -> Result<ClockReturn, ClockReturn> {
|
||||
unsafe {
|
||||
from_glib(self.0.compare_and_swap(
|
||||
self.0
|
||||
.compare_exchange(
|
||||
current.to_glib(),
|
||||
new.to_glib(),
|
||||
atomic::Ordering::SeqCst,
|
||||
))
|
||||
atomic::Ordering::SeqCst,
|
||||
)
|
||||
.map(|v| from_glib(v))
|
||||
.map_err(|v| from_glib(v))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue