mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
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)) }
|
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 {
|
unsafe {
|
||||||
from_glib(self.0.compare_and_swap(
|
self.0
|
||||||
current.to_glib(),
|
.compare_exchange(
|
||||||
new.to_glib(),
|
current.to_glib(),
|
||||||
atomic::Ordering::SeqCst,
|
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