Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-08-02 08:51:35


--- In boost_at_y..., "Alexander Terekhov" <terekhov_at_d...> wrote:
>
> > > also, named mutex
> > > need to be associated with &once (once control variable).
> >
> > No, it doesn't "need" to be. With it not being associated with
&once
> > it's just a "global" mutex. Every call to run_once() will use the
> > same conceptual mutex (I say conceptual since the named mutex may
or
> > may not still actually exist in a call, so may or may not be
> > created). The Kernel will handle all synch issues of the creation
> > here.
>
> one "global" mutex would result in rather excessive synchronization
> (it could hurt; especially at system IPL time) perhaps i was not
> clear enough.. it does need association with running process (pid)
> to avoid creation of interprocess bottleneck;
> it does need association
> with once control variable (address) to avoid creation of
intraprocess
> bottleneck.

I'll agree with all that, though "need" is the wrong word ;). You're
talking optimizations here, which are very important, but the code I
gave will provide safe and correct once methods.

Also, when you talked about association with &once I thought that you
meant the handle should be part of the opaque once_t type, which
simply would be a pain. Simply incorporating the address of &once in
the name of the mutex created is a nice solution, however.

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk