@@ -70,8 +70,12 @@ impl RunQueue {
70
70
///
71
71
/// `item` must NOT be already enqueued in any queue.
72
72
#[ inline( always) ]
73
- pub ( crate ) unsafe fn enqueue ( & self , task : TaskRef , _: super :: state:: Token ) -> bool {
74
- self . stack . push_was_empty ( task)
73
+ pub ( crate ) unsafe fn enqueue ( & self , task : TaskRef , _tok : super :: state:: Token ) -> bool {
74
+ self . stack . push_was_empty (
75
+ task,
76
+ #[ cfg( not( target_has_atomic = "ptr" ) ) ]
77
+ _tok,
78
+ )
75
79
}
76
80
77
81
/// # Standard atomic runqueue
@@ -153,26 +157,28 @@ fn run_dequeue(taskref: &TaskRef) {
153
157
/// A wrapper type that acts like TransferStack by wrapping a normal Stack in a CS mutex
154
158
#[ cfg( not( target_has_atomic = "ptr" ) ) ]
155
159
struct MutexTransferStack < T : Linked < cordyceps:: stack:: Links < T > > > {
156
- inner : mutex :: BlockingMutex < mutex :: raw_impls :: cs :: CriticalSectionRawMutex , cordyceps:: Stack < T > > ,
160
+ inner : critical_section :: Mutex < core :: cell :: RefCell < cordyceps:: Stack < T > > > ,
157
161
}
158
162
159
163
#[ cfg( not( target_has_atomic = "ptr" ) ) ]
160
164
impl < T : Linked < cordyceps:: stack:: Links < T > > > MutexTransferStack < T > {
161
165
const fn new ( ) -> Self {
162
166
Self {
163
- inner : mutex :: BlockingMutex :: new ( cordyceps:: Stack :: new ( ) ) ,
167
+ inner : critical_section :: Mutex :: new ( core :: cell :: RefCell :: new ( cordyceps:: Stack :: new ( ) ) ) ,
164
168
}
165
169
}
166
170
167
- fn push_was_empty ( & self , item : T :: Handle ) -> bool {
168
- self . inner . with_lock ( |stack| {
169
- let is_empty = stack. is_empty ( ) ;
170
- stack. push ( item) ;
171
- is_empty
172
- } )
171
+ fn push_was_empty ( & self , item : T :: Handle , token : super :: state:: Token ) -> bool {
172
+ let mut guard = self . inner . borrow_ref_mut ( token) ;
173
+ let is_empty = guard. is_empty ( ) ;
174
+ guard. push ( item) ;
175
+ is_empty
173
176
}
174
177
175
178
fn take_all ( & self ) -> cordyceps:: Stack < T > {
176
- self . inner . with_lock ( |stack| stack. take_all ( ) )
179
+ critical_section:: with ( |cs| {
180
+ let mut guard = self . inner . borrow_ref_mut ( cs) ;
181
+ guard. take_all ( )
182
+ } )
177
183
}
178
184
}
0 commit comments