Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::unordered_map thread safety
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2008-11-10 16:43:49

Daniel James wrote:
> 2008/11/10 Kenny Riddile <kfriddile_at_[hidden]>:
>> This is a simple question, but a quick search didn't turn up any answers.
>> Is it safe for multiple readers to access a boost::unordered_map
>> concurrently?
> Yes, as long as nothing modifies it (and the key and mapped object,
> hash function and key predicate are appropriately safe, of course).
> This is the same as any STL container.
> Daniel

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.
Still, it's good to know that using boost::unordered_map this way is ok.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at