|
1 | 1 | //! Utterly inefficient cross-platform preemptive user-mode scheduling |
2 | 2 | use once_cell::sync::OnceCell; |
3 | | -use parking_lot::{Mutex, MutexGuard}; |
4 | 3 | use std::{ |
5 | 4 | panic::{catch_unwind, AssertUnwindSafe}, |
6 | | - sync::{mpsc, Arc}, |
| 5 | + sync::{mpsc, Arc, Mutex, MutexGuard}, |
7 | 6 | thread::Result, |
8 | 7 | }; |
9 | 8 |
|
@@ -117,7 +116,7 @@ impl<Sched: Scheduler + ?Sized> ThreadGroup<Sched> { |
117 | 116 | pub fn lock(&self) -> ThreadGroupLockGuard<'_, Sched> { |
118 | 117 | ThreadGroupLockGuard { |
119 | 118 | state_ref: &self.state, |
120 | | - guard: self.state.lock(), |
| 119 | + guard: self.state.lock().unwrap(), |
121 | 120 | } |
122 | 121 | } |
123 | 122 | } |
@@ -270,7 +269,7 @@ pub fn yield_now() { |
270 | 269 | .expect("current thread does not belong to a thread group"); |
271 | 270 |
|
272 | 271 | { |
273 | | - let mut state_guard = thread_group.lock(); |
| 272 | + let mut state_guard = thread_group.lock().unwrap(); |
274 | 273 | log::trace!("{:?} yielded the processor", state_guard.cur_thread_id); |
275 | 274 | state_guard.unpark_next_thread(); |
276 | 275 | } |
@@ -311,7 +310,7 @@ fn finalize_thread( |
311 | 310 | log::trace!("{:?} exited with result {:?}", thread_id, result); |
312 | 311 |
|
313 | 312 | // Delete the current thread |
314 | | - let mut state_guard = thread_group.lock(); |
| 313 | + let mut state_guard = thread_group.lock().unwrap(); |
315 | 314 | state_guard.sched.thread_exited(thread_id); |
316 | 315 | state_guard.threads.deallocate(thread_id.0).unwrap(); |
317 | 316 | state_guard.num_threads -= 1; |
|
0 commit comments