| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
BQueue.Interrupt(notifyAll) called notify() when notifyAll was True and notify_all() when it was False — the opposite of the parameter's meaning. As a result, Interrupt(notifyAll=True) woke only a single blocked Get() waiter instead of all of them. Swap the two branches so the parameter behaves as documented.
| Back | FazBrowse Home | New Git URL |
Problem
BQueue.Interrupt(notifyAll) calls the wrong Condition method for each branch:
The two branches are swapped relative to the parameter's meaning: notifyAll=True wakes only a single blocked Get() waiter, while the default notifyAll=False wakes all of them. So a caller that relies on Interrupt(notifyAll=True) to release every consumer blocked in Get() only releases one; the rest keep waiting until their timeout (or forever, if called with timeout=None).
The current in-tree caller (core/channel.py Close()) uses the default and has a single consumer thread, so it happens to work — but the method's contract is still inverted.
Reproduce
Fix
Swap the two branches so notifyAll=True calls notify_all() and notifyAll=False calls notify(). After the fix the snippet prints [0, 1], and the single-consumer Interrupt() path used by channel.py is unchanged.