> cv_signal() unblocks only a single thread. The implementation is in > kern/kern_condvar.c, and it’s very clear and obvious how it works. I assume > what you’re referring to is the warning about spurious wakes, which is in the > description if cv_wait(), and is a completely separate issue.
Just tested this again with the port system (not the semaphore system) because I have test programs there which suit better for this purpose. https://github.com/stephanwib/src/blob/trunk/sys/kern/uipc_port.c Both systems work pretty much the same in this regard. I am sorry to say that but I am still seeing this behaviour with both the ticks to wait being zero (= wait forever case) or greater zero (timeout case). I added a printf reporting the status: printf("port write wakeup. port: %d, error code: %d, waiters: %d\n", id, error, port->kp_waiters); All threads wake up reporting error code 0 and the same amount of waiting threads :-/ The only thing left to mention is that I am working on a 2 years old snapshot of the source as syncing to upstream does not seem to be easy. Stephan