Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2007-09-21 08:11:35


Tobias Schwinger <tschwinger_at_[hidden]> writes:

> Anthony,
>
> Anthony Williams wrote:
>> POSIX provides pthread_once. We should use it. The Windows Vista functions
>> look to supply a similar facility, and do at least allow the passing of a
>> parameter to the routine without using TSS.
>
> did you catch my comments on this one (elsewhere in this thread)?

No. Thanks for repeating them here.

> <cite>
> The pthread-based implementation seems overly simplified: It won't
> compile for C++ functions that are not 'extern "C"' with some
> compilers.
> Further, what about exceptions from within pthread_once?
> </cite>

I haven't written a pthread-based implementation yet, so I'm not sure what
you're referring to. Current boost call_once is not header-only, and doesn't
support arbitrary callable objects (like my new Windows version does) --- only
functions of a fixed signature.

> I agree that TSS is not a good alternative, however (but I don't think
> it's needed for an improved pthread-based implementation).

I'm interested in what you expect an improved pthread-based implementation to
look like. I'm thinking it will look very much like Peter's extended
pthread_once that took an additional parameter (from N2178) --- i.e. using TSS
to pass the parameter to the routine passed to pthread_once, which can then
use this parameter data to invoke the user-supplied callable object. Have you
got a better way?

Anthony

-- 
Anthony Williams
Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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