Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::unordered_map thread safety
From: Daniel Krügler (dsp_at_[hidden])
Date: 2008-11-11 04:34:15


Jonathan Franklin wrote:
> On Mon, Nov 10, 2008 at 2:43 PM, Kenny Riddile <kfriddile_at_[hidden]
> <mailto:kfriddile_at_[hidden]>> wrote:
>
> I could be wrong, but I don't think the standard says anything about
> the thread safety of STL containers, so it's implementation-specific.
>
> The standard says nothing of thread safety. However, 17.4.4.5
> <http://17.4.4.5> says "Which of the functions in the C++ Standard
> Library are not reentrant subroutines is implementation-defined." So at
> least wrt reentrancy it's implementation defined.

In the context of unordered containers it seems appropriate to consider
the direction the standard is going. The most recent draft N2798 has
updated some parts of the library introduction to take care of this.

In 17.6.4.10 [res.on.objects] we have:

"The behavior of a program is undefined if calls to standard library
functions from different threads may introduce a data race. The
conditions under which this may occur are specified in 17.6.5.7."

and in 17.6.5.7 [res.on.data.races] we find several added/updated
paragraphs. Please read details in:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf

- Daniel


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net