Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2003-12-29 17:32:32

Narendran wrote:
> I am working on boost::random. I am using this in boost::thread. Whether
> boost::random is thread safe. If not how to make it thread safe.

Boost.random does not maintain global state that would need
protection from multi-threading.

boost.random is thread-safe as long as you don't access
any given object from two threads simultaneously.
(Accessing two different objects is ok, as long as
they don't share an engine).
If you require that kind of safety, it's trivial to
roll that on your own with an appropriate mutex

Jens Maurer

Boost list run by bdawes at, gregod at, cpdaniel at, john at