This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes count++ atomic / thread safe? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "count++ atomic / thread safe?" Watch "count++ atomic / thread safe?" New topic
Author

count++ atomic / thread safe?

Peter Cork
Greenhorn

Joined: Jun 08, 2005
Posts: 3
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
Marshal

Joined: Jul 08, 2003
Posts: 24057
    
  13

Yes, that's right. It's not thread safe.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: count++ atomic / thread safe?
 
Similar Threads
ThreadUnsafe
Sybex book: p.276. Synchronization issue.
Sorting Of Array From Even Number To Odd Number
Doubt in a Threads