diff --git a/README.md b/README.md index e2917dcc299..ee5fd5a2f42 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ The course aims to equip students with the ability to: ### Textbook - [Slides](https://docs.google.com/presentation/d/1NMg08N1LUNDPuMxNZ-UMbdH13p8LXgMM3esbWRMowhU/edit?usp=sharing) +- [Code Documentation](https://kaist-cp.github.io/cs431/cs431/) - References + [The Art of Multiprocessor Programming](https://dl.acm.org/doi/book/10.5555/2385452) + [The Crossbeam Library Documentation](https://docs.rs/crossbeam/latest/crossbeam/) @@ -181,7 +182,7 @@ Ensure you are proficient with the following development tools: - All assignments will be announced at the start of the semester. - Submit your solutions to . -- Refer to the documentation at . +- Refer to the documentation at . - You are **permitted** to use ChatGPT or other LLMs. diff --git a/src/lock/mcsparkinglock.rs b/src/lock/mcsparkinglock.rs index 5e6dc673871..7d1a7d1d0f3 100644 --- a/src/lock/mcsparkinglock.rs +++ b/src/lock/mcsparkinglock.rs @@ -89,6 +89,9 @@ unsafe impl RawLock for McsParkingLock { // SAFETY: See safety of McsLock::unlock(). drop(unsafe { Box::from_raw(node) }); let next_ref = unsafe { &*next }; + + // It is important to clone the thread before unlocking, the next waiter, + // because then the next waiter may free `next_ref`. let thread = next_ref.thread.clone(); next_ref.locked.store(false, Release); thread.unpark();