
6 Jun
2006
6 Jun
'06
3:26 p.m.
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