Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: wake Latch outside of lock.
Given: - thread A asleep in Latch._get_sleep() - thread B calling Latch.put() Previously, - B takes lock, - B wakes socket by dropping GIL and writing to it - A wakes from poll(), acquires GIL only to find Latch._lock is held - A drops GIL, sleeps on futex() for _lock - B wakes, acquires GIL, releases _lock - A wakes from futex(), acquires lock Now, - B takes lock, updates state, releases lock - B wakes socket by droppping GIL and writing to it - A wakes from poll(), acquires GIL and _lock - Everyone lives happily ever after.
- Loading branch information
Showing with 4 additions and 1 deletion.
- +4 −1 mitogen/core.py