Repository navigation
Keep the mutex handoff test waiter locked until observation #9273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -271,11 +271,14 @@ mod tests { | |
| #[test] | ||
| fn unlock_hands_off_to_starved_waiter() { | ||
| let m = Arc::new(PyMutex::new()); | ||
| let (release_waiter, wait_for_release) = std::sync::mpsc::channel::<()>(); | ||
| m.lock(); | ||
| let waiter = { | ||
| let m = m.clone(); | ||
| std::thread::spawn(move || { | ||
| m.lock(); | ||
| // Keep ownership until the parent has checked the handoff. | ||
| let _ = wait_for_release.recv(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If the implementation regresses to a normal (non- Useful? React with 👍 / 👎. |
||
| m.unlock(); | ||
| }) | ||
| }; | ||
|
|
@@ -285,9 +288,14 @@ mod tests { | |
| // Long past the waiter's fairness deadline. | ||
| std::thread::sleep(Duration::from_millis(20)); | ||
| m.unlock(); | ||
| // The waiter owns the lock before it has even run again. | ||
| assert!(!m.lock_fast()); | ||
| // Check immediately, without waiting for the waiter to run again. | ||
| let acquired = m.lock_fast(); | ||
| if acquired { | ||
| m.unlock(); | ||
| } | ||
| drop(release_waiter); | ||
| waiter.join().unwrap(); | ||
| assert!(!acquired); | ||
| assert!(!m.is_locked()); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message explicitly says Codex assisted, but it contains no
Assisted-by: AGENT_NAME:MODEL_VERSIONtrailer. RustPython requires that exact trailer for every AI-assisted contribution, so this commit's metadata must be corrected before integration.AGENTS.md reference: AGENTS.md:L23-L23
Useful? React with 👍 / 👎.