Re: How to wait on cv_timedwait() correctly
Stephan <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.kernel |
|---|---|
| Message-ID | <CABZpUSXeqxk362+jUgBfrzck1-Tu04jP5LBejkG_mh5Ex7if0Q@mail.gmail.com> |
> 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