On 05-Jan-01 Kazutaka YOKOTA wrote:
> In order to declare a mutex which will be used before malloc(9)
> becomes available in the kernel, MUTEX_DECLARE() should be used, then
> it should be initialized by passing the MTX_COLD flag to mtx_init(),
> so that a statically allocated buffer will be used, instead of
> malloc()ing a buffer, right?
> Will it be safe to call mtx_destroy() for this mutex?
> /sys/kern/kern_mutex.c:mtx_destroy() seems to always try to free() the
No, the assumption is that anything that comes before malloc is so critical
that it won't be destroyed, and thus one shouldn't have to worry about this.
If you have a mutex that is used before malloc() and needs to be destroy'd
(doing so won't free any memory, the mutex is already statically allocated)
then mtx_destroy() could be taught to handle MTX_COLD being passed in, but I'd
be surprised that such a mutex exists..
John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.Baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message