• Post Reply Bookmark Topic Watch Topic
  • New Topic

count++ atomic / thread safe?  RSS feed

 
Peter Cork
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have something like:



Am I right to assume this is not thread safe? ie the same number could be return by more than one thread.

Cheers

Peter
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's right. It's not thread safe.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!