Boost logo

Boost Users :

Subject: [Boost-users] [Thread] TLS / locking ?
From: beet (r.berlich_at_[hidden])
Date: 2013-11-24 13:02:41


Hi there,

I have a number of threads and, within the context of each thread, a
large number of objects may be active. I would now like to provide all
objects accessed by a thread with a common random number generator.
i.e., there would be as many random number generators as there are
threads, and all objects active inside of a given thread would access
the same generator, but objects in different threads use different
generators. The obvious approach would be to store the generator in
thread-local storage.

I am concerned, however, about the performance implications. In
particular, does access to thread-local storage implicitly involve
locking of sorts? If so, the (very) frequent access to the random number
generator would effectively serialize my application.

Thanks and Best Regards,
Beet


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