tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to wait on cv_timedwait() correctly



> cv_signal() unblocks only a single thread.

That is what I expected, but saw it released all waiters. However, it
might be that all waiters had the timeout set to 0, turning this
essentially into cv_wait_sig().

I will test this again carefully with some more debug output.


> 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.

I think I need to optimize this to handle these wakeups for whatever
reason they may occur.

It might also happen that a releasing thread increases the count of a
semaphore somewhat below what the acquiring thread needs. This would
be a regular wakeup without acquisition and requires adjusting the
remaining timeout as well.


Stephan


Home | Main Index | Thread Index | Old Index