aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-07-29 16:26:45 +0000
committerGitHub <[email protected]>2022-07-29 16:26:45 +0000
commit8745d646f0976791b7098456aa61adb983fb1c18 (patch)
tree08164c1aa46cffb6267539e0fa028aa26f919c17
parent9af68e005b91a35d1c741bc1d6e90f9c43be18b9 (diff)
parent3b9c26fbd8a68feb59f8f66f9b1ec456440408fe (diff)
Merge #882
882: Remove separation of stable vs. nightly implementations in executor/raw r=Dirbaio a=jannic Since rust 1.61, the required const features are availabe on stable rust Co-authored-by: Jan Niehusmann <[email protected]>
-rw-r--r--embassy/src/executor/raw/mod.rs29
1 files changed, 0 insertions, 29 deletions
diff --git a/embassy/src/executor/raw/mod.rs b/embassy/src/executor/raw/mod.rs
index 7e8559168..0cfe617eb 100644
--- a/embassy/src/executor/raw/mod.rs
+++ b/embassy/src/executor/raw/mod.rs
@@ -57,7 +57,6 @@ pub struct TaskHeader {
57} 57}
58 58
59impl TaskHeader { 59impl TaskHeader {
60 #[cfg(feature = "nightly")]
61 pub(crate) const fn new() -> Self { 60 pub(crate) const fn new() -> Self {
62 Self { 61 Self {
63 state: AtomicU32::new(0), 62 state: AtomicU32::new(0),
@@ -72,21 +71,6 @@ impl TaskHeader {
72 } 71 }
73 } 72 }
74 73
75 #[cfg(not(feature = "nightly"))]
76 pub(crate) fn new() -> Self {
77 Self {
78 state: AtomicU32::new(0),
79 run_queue_item: RunQueueItem::new(),
80 executor: Cell::new(ptr::null()),
81 poll_fn: UninitCell::uninit(),
82
83 #[cfg(feature = "time")]
84 expires_at: Cell::new(Instant::from_ticks(0)),
85 #[cfg(feature = "time")]
86 timer_queue_item: timer_queue::TimerQueueItem::new(),
87 }
88 }
89
90 pub(crate) unsafe fn enqueue(&self) { 74 pub(crate) unsafe fn enqueue(&self) {
91 critical_section::with(|cs| { 75 critical_section::with(|cs| {
92 let state = self.state.load(Ordering::Relaxed); 76 let state = self.state.load(Ordering::Relaxed);
@@ -128,11 +112,9 @@ pub struct TaskStorage<F: Future + 'static> {
128} 112}
129 113
130impl<F: Future + 'static> TaskStorage<F> { 114impl<F: Future + 'static> TaskStorage<F> {
131 #[cfg(feature = "nightly")]
132 const NEW: Self = Self::new(); 115 const NEW: Self = Self::new();
133 116
134 /// Create a new TaskStorage, in not-spawned state. 117 /// Create a new TaskStorage, in not-spawned state.
135 #[cfg(feature = "nightly")]
136 pub const fn new() -> Self { 118 pub const fn new() -> Self {
137 Self { 119 Self {
138 raw: TaskHeader::new(), 120 raw: TaskHeader::new(),
@@ -140,15 +122,6 @@ impl<F: Future + 'static> TaskStorage<F> {
140 } 122 }
141 } 123 }
142 124
143 /// Create a new TaskStorage, in not-spawned state.
144 #[cfg(not(feature = "nightly"))]
145 pub fn new() -> Self {
146 Self {
147 raw: TaskHeader::new(),
148 future: UninitCell::uninit(),
149 }
150 }
151
152 /// Try to spawn the task. 125 /// Try to spawn the task.
153 /// 126 ///
154 /// The `future` closure constructs the future. It's only called if spawning is 127 /// The `future` closure constructs the future. It's only called if spawning is
@@ -210,12 +183,10 @@ unsafe impl<F: Future + 'static> Sync for TaskStorage<F> {}
210/// Raw storage that can hold up to N tasks of the same type. 183/// Raw storage that can hold up to N tasks of the same type.
211/// 184///
212/// This is essentially a `[TaskStorage<F>; N]`. 185/// This is essentially a `[TaskStorage<F>; N]`.
213#[cfg(feature = "nightly")]
214pub struct TaskPool<F: Future + 'static, const N: usize> { 186pub struct TaskPool<F: Future + 'static, const N: usize> {
215 pool: [TaskStorage<F>; N], 187 pool: [TaskStorage<F>; N],
216} 188}
217 189
218#[cfg(feature = "nightly")]
219impl<F: Future + 'static, const N: usize> TaskPool<F, N> { 190impl<F: Future + 'static, const N: usize> TaskPool<F, N> {
220 /// Create a new TaskPool, with all tasks in non-spawned state. 191 /// Create a new TaskPool, with all tasks in non-spawned state.
221 pub const fn new() -> Self { 192 pub const fn new() -> Self {