Boost logo

Boost :

From: William E. Kempf (williamkempf_at_[hidden])
Date: 2002-06-20 12:33:56


----- Original Message -----
From: "Dirk Gerrits" <dirkg_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, June 20, 2002 11:08 AM
Subject: Re: [boost] Some Boost.Threads observations

> Peter Dimov wrote:
> > 3. Speaking of template<class F>, are there plans to extend boost::once
to
> > accept function objects?
> >
> > template<class F> void once(F f, once_flag & flag);
>
> I believe this was not done because the F constructor could cause race
> conditions. A function pointer doesn't have that problem.
>
> Some one correct me if I'm wrong though.

That was the original reasoning, yes, but it's not valid. So long as the
function object doesn't use any shared data (and isn't shared itself) then
there's no race condition involved in it's construction.

Bill Kempf


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