Repository navigation
Broadcast at monitor exit, so a thread entering always wakes - #20
Conversation
|
The red build on I replayed the same tree on my fork. Unchanged, it failed the same way, on With the job-level env you suggested in ocicl/ocicl#210 ( So a re-run of the master job should go green. I can open a PR with the env lines if you want them until the ocicl fix ships. |
|
Thanks — I cherry-picked 6c98d86 from your |
wait(J) and wait0(J) give up the monitor and wake one thread on its condition variable, which threads entering share with threads in wait(). When that wakeup lands on another wait(), the thread entering sleeps at the door of a free monitor until the other wait times out. This is the same lost wakeup PR atgreen#20 fixed in monitor-exit; broadcast here too. The new aaa/waitwake.java enters after ~5000 ms without the fix (3/3) and immediately with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
monitor-exitfrees the monitor and wakes one thread withbordeaux-threads:condition-notify, on the monitor's condition variable, which threads blocked entering share with threads inObject.wait(). When the wakeup lands on await(), that thread sees it is still in the wait set and goes back to sleep, and a thread entering stays asleep at the door of a free monitor until something else wakes it.This makes it
sb-thread:condition-broadcast, whichnotify()andnotifyAll()already use on the same condition variable. Threads entering re-check the owner and all but one go back to waiting; threads inwait()re-check their wait-set membership, as they already must.Checks: the new
aaa/monitorwake.java, a thread entering while another holds the monitor for 300 ms and a third sits inwait(5000), entered after about 5190 ms on master three runs out of three, when the expiring wait exited the monitor and notified again, and after about 190 ms with the fix.make check-regressionpasses on macOS arm64, 504 core passes, no losses against the baseline.Re-verified against
masterat4498cd2(2026-10-19).