issue #156: handle multiple _put() before wake of first sleeper
- If latch.get() is called and the queue is empty, a thread is put to sleep. - If Latch.put() from another thread then appends an item to the queue and wakes the sleeping thread, and - If a subsequent Latch.put() from the same or another thread manages to acquire `lock` before the sleeping thread is scheduled, - The sleeping thread's wake socket would have multiple bytes written to it. Therefore create a new _pending variable to track the only item assigned to each thread (keyed by its write socket), and remove the socket from `sleeping` from within put.
Showing
Please register or sign in to comment