Skip to content

QSem makes nonsense claim

It says waiting threads are serviced in FIFO order. This isn't really a meaningful statement. What does "first in" mean? Furthermore, the first step in waitQSem is takeMVar, which provides no ordering guarantees whatsoever. As far as I can tell, there's no meaningful difference between a thread waiting a long time in the queue and one waiting a long time to get into the queue. So I think we probably want to weaken the promise here to match the MVar fairness guarantee: if a thread waits on a QSem, and that QSem continues to be signaled, then the thread will eventually proceed.

Edited by David Feuer
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information