|
Boost Users : |
From: Carlo Wood (carlo_at_[hidden])
Date: 2006-06-06 11:26:56
On Tue, Jun 06, 2006 at 02:53:50PM +0200, Anne-Gert Bultena wrote:
> On the other hand, Since a
> constant value is written, it doesn't need to be a problem, even in a multi threaded environment.
>
> example:
>
> int generate()
> {
> static int number = 10;
> return number++;
> }
This is not thread-safe when two different threads call
generate at the same time. number++ both reads and writes to number.
-- Carlo Wood <carlo_at_[hidden]>
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