tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: NetBSD vs Solaris condvar semantics
Date: Sun, 14 Oct 2012 10:04:53 +0100
From: David Laight <david%l8s.co.uk@localhost>
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 both illumos and NetBSD, cv_init only initializes the memory. In
illumos, cv_destroy is actually always a no-op (modulo consistency
checks), whereas in NetBSD, it has nontrivial effects when LOCKDEBUG
or DIAGNOSTIC is enabled. I have not checked the older OpenSolaris
code, but I assume it probably hasn't changed much in illumos.
For reference, the illumos code I'm reading is at
<https://github.com/joyent/illumos-joyent/blob/090f8e7a981e84e43138990d5d8e06fe26bc09c4/usr/src/uts/common/os/condvar.c>.
These will be a lot of implementations of 'cv' where cv_wait() has
to look at the cv after being woken.
Correct, hence the question about tastelessness. For example, the
rump implementation of kernel condvars does this. It would be more
involved to make the idiom work for rump, perhaps by putting the
reference-counting scheme I described into the implementation of
librumpuser condvars; and perhaps this would not be worth the trouble.
Home |
Main Index |
Thread Index |
Old Index