You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the close method does not lock and the read method does not check the closed value after locking, it's possible for a deadlock to occur under the following series of events:
Thread 1 (reader): read last element from the channel
Thread 1: call operator>>
Thread 1: check closed(), which is false
Thread 1: lock mutex
Thread 1: check the predicate in wait()
Thread 2 (writer): call close()
Thread 2: set closed=true
Thread 2: call cnd_.notify_all()
Thread 1: calls wait() without predicate (in the implementation of the wait with predicate method)
At this point, Thread 1 waits forever because the notify_all occurred before the actual call to wait().
The text was updated successfully, but these errors were encountered:
Because the close method does not lock and the read method does not check the closed value after locking, it's possible for a deadlock to occur under the following series of events:
Thread 1 (reader): read last element from the channel
Thread 1: call operator>>
Thread 1: check closed(), which is false
Thread 1: lock mutex
Thread 1: check the predicate in wait()
Thread 2 (writer): call close()
Thread 2: set closed=true
Thread 2: call cnd_.notify_all()
Thread 1: calls wait() without predicate (in the implementation of the wait with predicate method)
At this point, Thread 1 waits forever because the notify_all occurred before the actual call to wait().
The text was updated successfully, but these errors were encountered: