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
wrapper.

Jens Maurer


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