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 07:20:02AM +0000, Taylor R Campbell wrote:
> I'm working on fixing ZFS locking, and I ran into a diference between
> NetBSD's and Solaris's interpretation of condvars.
> In Solaris, it seems to be kosher to do
>    cv_broadcast(cv);
>    cv_destroy(cv);
> at least if waiters use only cv_wait and not cv_wait_sig &c.  That
> idiom makes NetBSD very unhappy, though, because cv_wait wants to
> continue using cv after it is woken, at which point cv may already be
> destroyed.

Hmmm.... IIRC solaris kernel cv_init() is actually a malloc, so cv_destroy()
is a free() - and thus mandatory.
OTOH doesn't NetBSD's cv_init() just initialise the memory, making
cv_destroy() not strictly necessary?
In which case you might be able to just #define them away!
Unless the code also frees the memory block that contains the cv itself.

These will be a lot of implementations of 'cv' where cv_wait() has
to look at the cv after being woken.


David Laight:

Home | Main Index | Thread Index | Old Index