There is an assumption that at any time, there is either 1 or 0 bytes in the pipe.
This assumption breaks if 2 threads call set, each checks the flags, sees that it's false, sets it to true and writes a byte to the pipe. After that - if we call clear, it will only read 1 of the bytes, so the flag will be false but the fd will still be readable, a wait will return immediately without actually waiting for a set in that case.
There is an assumption that at any time, there is either 1 or 0 bytes in the pipe.
This assumption breaks if 2 threads call
set, each checks the flags, sees that it's false, sets it to true and writes a byte to the pipe. After that - if we callclear, it will only read 1 of the bytes, so the flag will be false but the fd will still be readable, awaitwill return immediately without actually waiting for asetin that case.