From 47d9787269e7b5b86c87cfa3f82d5442e985ba59 Mon Sep 17 00:00:00 2001 From: Janggun Lee Date: Thu, 31 Oct 2024 19:20:37 +0900 Subject: [PATCH] Add some comments and update documentation link. --- README.md | 3 ++- src/lock/mcsparkinglock.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e2917dcc29..ee5fd5a2f4 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 5e6dc67387..7d1a7d1d0f 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();