Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Apr 2002 19:21:44 -0500
From:      Jake Burkholder <jake@locore.ca>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        John Baldwin <jhb@FreeBSD.ORG>, smp@FreeBSD.ORG, "Andrew R. Reiter" <arr@FreeBSD.ORG>
Subject:   Re: Where to initialize certain locks...
Message-ID:  <20020402192144.Q207@locore.ca>
In-Reply-To: <3CAA422A.4CAF1CAE@mindspring.com>; from tlambert2@mindspring.com on Tue, Apr 02, 2002 at 03:43:38PM -0800
References:  <XFMail.20020402110910.jhb@FreeBSD.org> <3CAA422A.4CAF1CAE@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Apparently, On Tue, Apr 02, 2002 at 03:43:38PM -0800,
	Terry Lambert said words to the effect of;

> John Baldwin wrote:
> > > Initialized to what non-default setting?
> > >
> > > Initializing a lock as locked is a bad idea.  Initializing it as
> > > unlocked is, well, automatic.
> > 
> > No it's not.
> 
> Then the design is broken.  It means you can't statically declare
> locks.  This is one of the reasons the POSIX mutexes sucked in
> Draft 4, and one of the major reasons the standard version of
> pthreads was better than draft 4.
> 
> If this is the case, then there needs to be constructor-intialization
> available (see the Moscow Center for Supercomputing Activities
> support for static class declaration of mutex containing classes,
> for NT and Draft 4 POSIX threads -- I wrote the Draft 4 support).

The reason they need to be initialized is to insert them into an all_mtx
list which is used for debugging.  Otherwise there's no problem; the lock
for said list is statically initialized.

This is the kernel.  This is not pthreads.  Arguably anything that depends
on them needing to be statically initialized to unlocked and usable is
broken.

Jake

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020402192144.Q207>