Remove use of deprecated compare_and_swap.
This commit is contained in:
parent
015b6bbce4
commit
bb6f25d010
@ -150,7 +150,7 @@ pub fn interrupt_take(item: TokenStream) -> TokenStream {
|
||||
|
||||
static TAKEN: ::core::sync::atomic::AtomicBool = ::core::sync::atomic::AtomicBool::new(false);
|
||||
|
||||
if TAKEN.compare_and_swap(false, true, ::core::sync::atomic::Ordering::AcqRel) {
|
||||
if TAKEN.compare_exchange(false, true, ::core::sync::atomic::Ordering::AcqRel, ::core::sync::atomic::Ordering::Acquire).is_err() {
|
||||
panic!("IRQ Already taken");
|
||||
}
|
||||
|
||||
|
@ -105,8 +105,8 @@ impl<F: Future + 'static> Task<F> {
|
||||
if task
|
||||
.header
|
||||
.state
|
||||
.compare_and_swap(0, state, Ordering::AcqRel)
|
||||
== 0
|
||||
.compare_exchange(0, state, Ordering::AcqRel, Ordering::Acquire)
|
||||
.is_ok()
|
||||
{
|
||||
// Initialize the task
|
||||
task.header.poll_fn.write(Self::poll);
|
||||
|
@ -19,7 +19,11 @@ impl<T> Forever<T> {
|
||||
}
|
||||
|
||||
pub fn put(&'static self, val: T) -> &'static mut T {
|
||||
if self.used.compare_and_swap(false, true, Ordering::SeqCst) {
|
||||
if self
|
||||
.used
|
||||
.compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire)
|
||||
.is_ok()
|
||||
{
|
||||
panic!("Forever.put() called multiple times");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user