On Thu, 2006-06-08 at 06:48, Roch wrote: > Quick background check: Is the thread calling cv_signal() > holding the lock passed to cv_wait ? Normally it should.
So, for what it's worth, I've seen a lot of people confused about why this is necessary or even helpful. IIRC the main reason for this was to avoid priority inversion -- if you drop the lock and get preempted by a higher-priority thread before you can cv_signal(), the cv_signal won't happen for a while and so a higher-priority thread in cv_wait() might not get to run for a while. Someone please correct me if I'm either (a) wrong about this, or (b) there are other reasons besides this one... - Bill