Boost logo

Boost :

From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-05-23 14:03:01


Peter Dimov said:
> Alexander Terekhov wrote:
>> Try to convince Dimov that policy-based designs/interfaces aren't that
>> bad; and that, in general, the stuff managed by smart pointers isn't
>> necessarily process-wide/thread-shared stuff "by default"... like
>> global heap, current working directory, etc.
>
> Policy based designs aren't bad. It's just that when I look at
> boost::shared_ptr I see std::shared_ptr. The existing practice is that
> things in the standard library are as thread safe as an int "by
> default". Nobody complains that std::string should have a threading
> model parameter since it can be (much) more efficient if it's only
> accessed from a single thread.

Things in the standard library aren't thread safe, unless an
implementation chooses to make it so. The standard doesn't specify
*anything* about threads, including the thread safety of any operations.

Obviously, everyone knows that. I'm stating it now to make a point. When
the standard finally does have something to say about threads, I'm not
sure that it's a given that we'll be able to say "things in the standard
library are as thread safe as an int" (or what many call thread-neutral).
If some standard "thing" *must* rely on shared state (not a given for
string, like it is for shared_ptr), I can certainly have sympathy with
those who want control over whether or not a particular instance of this
thing needs any synchronization.

-- 
William E. Kempf

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