On 18-May-2002 Terry Lambert wrote:
> John Baldwin wrote:
>> > God, it's annoying that a statically declared mutex is not
>> > defacto initialized.
>> Is it in solaris?
> It isn't in FreeBSD because of the need to link mutex'es into
> the "witness protection program".  8-).

Actually, there is more to it than that.  Or at least, there will be
when turnstiles are added (turnstiles require some function callouts
to work properly).

> MUTEX_DECLARE(mutex_name).

Umm, yes, like MTX_SYSINIT(). :)

> You could do this with a SYSINIT(), as has been suggested, but
> that would add a relatively large per mutex overhead for each
> one you want to declare, since you'd basically be repeating the
> common components for doing the job for each and every mutex,
> instead of sharing them.

Umm, this is a boot-up thing so it's not that big of a deal, plus
the actual code isn't duplicated, we call a common function for
the actual mutex initialization.

> Technically, some later programmer could come along and recover
> the linker set memory, actually, since it's only used once, for
> the traversal, at kernel startup.

Erm, they could do the same with the little mtx_args structs if
they want to as well, but I think it's more effor than its worth.

> -- Terry


John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
"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

Reply via email to