Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-08-15 19:47:45


--- In boost_at_y..., "Mark Rodgers" <mark.rodgers_at_c...> wrote:
> > The tss concept is undergoing a lot of work at the moment.
>
> Excellent.
>
> > currently exists is likely to become an implementation detail in
the
> > detail namespace with an easier to use template wrapping it. I'm
> > puzzling over a few things in this approach, however. Your code
> > above seems to indicate that the data is automagically allocated
for
> > you the first time you access it and deleted when the thread
ends.
>
> Yes please.
>
> > This brings up two issues. The first is that the creation
requires
> > default initialization semantics, which will exclude many types
from
> > being (directly) usable as thread specific storage.
>
> No, ideally I will be able to provide constructor arguments when I
> declare my TSS object:
>
> struct Foo
> {
> Foo( const std::string &s, int i );
> //...
> };
>
> boost::thread_specific<Foo> bob( "Bob", 3 );
>
> This would call Foo("Bob",3) to provide an initial value for bob for
> every new thread, and of course would clean up when threads
terminate.

And what for class types that take multiple arguments but don't have
copy constructors. How will you account for them in this scheme.

> >As for the name... suggest something better. I'm very open to
> >renaming this one.
>
> I think I just did make a suggestion. ;-)

I've decided to go with thread_specific_ptr<>. I didn't address all
of the issues I gave here, simply because I'm under a time crunch.
We can correct any issues with modifications during review, or
extensions later, or even with new concepts at a later date.

Bill Kempf


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