tech-kern archive

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

Re: NetBSD vs Solaris condvar semantics



On Sun, Oct 14, 2012 at 02:27:48PM +0000, Taylor R Campbell wrote:
>    Date: Sun, 14 Oct 2012 09:37:09 +0200
>    From: Martin Husemann <martin%duskware.de@localhost>
> 
>    In the zfs code, where do they store the mutex needed for cv_wait?
> 
> In the two cases I have come across, dirent locks and range locks, a
> number of condvars, one per dirent or one per range, share a common
> mutex in some common enclosing object, such as a znode.  So, e.g., the
> end of zfs_dirent_unlock looks like
> 
> cv_broadcast(&dl->dl_cv);       /* dl is a dirent lock stored in dzp.  */
> mutex_unlock(&dzp->z_lock);
> cv_destroy(&dl->dl_cv);
> kmem_free(dl, sizeof(*dl));

What do the waiters actually look like?
A lot of cv definitions allow for 'random' wakeups.
eg cv_broadcast() is allowed to wakeup all cv.
So after being woken you are required to check something....

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index