mirror of https://github.com/smol-rs/async-task
feat: Support for CPU architectures with no atomic instructions
Adds a `portable-atomic` feature to support these architectures.
This commit is contained in:
parent
e4131393be
commit
f222e1ced0
|
@ -51,6 +51,8 @@ jobs:
|
|||
run: cargo test -- --test-threads=1
|
||||
env:
|
||||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: valgrind -v --error-exitcode=1 --error-limit=no --leak-check=full --show-leak-kinds=all --track-origins=yes --fair-sched=yes
|
||||
- name: Run cargo test (with portable-atomic enabled)
|
||||
run: cargo test --features portable-atomic
|
||||
- name: Clone async-executor
|
||||
run: git clone https://github.com/smol-rs/async-executor.git
|
||||
- name: Add patch section
|
||||
|
|
|
@ -18,6 +18,10 @@ exclude = ["/.*"]
|
|||
default = ["std"]
|
||||
std = []
|
||||
|
||||
[dependencies]
|
||||
# Uses portable-atomic polyfill atomics on targets without them
|
||||
portable-atomic = { version = "1", optional = true, default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
atomic-waker = "1"
|
||||
easy-parallel = "3"
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
use core::cell::UnsafeCell;
|
||||
use core::fmt;
|
||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||
use core::task::Waker;
|
||||
|
||||
#[cfg(not(feature = "portable-atomic"))]
|
||||
use core::sync::atomic::AtomicUsize;
|
||||
use core::sync::atomic::Ordering;
|
||||
#[cfg(feature = "portable-atomic")]
|
||||
use portable_atomic::AtomicUsize;
|
||||
|
||||
use crate::raw::TaskVTable;
|
||||
use crate::state::*;
|
||||
use crate::utils::abort_on_panic;
|
||||
|
|
|
@ -5,9 +5,14 @@ use core::marker::PhantomData;
|
|||
use core::mem::{self, ManuallyDrop};
|
||||
use core::pin::Pin;
|
||||
use core::ptr::NonNull;
|
||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||
use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
|
||||
|
||||
#[cfg(not(feature = "portable-atomic"))]
|
||||
use core::sync::atomic::AtomicUsize;
|
||||
use core::sync::atomic::Ordering;
|
||||
#[cfg(feature = "portable-atomic")]
|
||||
use portable_atomic::AtomicUsize;
|
||||
|
||||
use crate::header::Header;
|
||||
use crate::runnable::{Schedule, ScheduleInfo};
|
||||
use crate::state::*;
|
||||
|
|
Loading…
Reference in New Issue