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.
A friendly place for programming greenhorns!
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
Author
count++ atomic / thread safe?
Peter Cork
Greenhorn
Joined: Jun 08, 2005
Posts: 3
posted
Jun 08, 2005 09:00:00
0
If I have something like:
public class Test { static int count; public int getUniqueCountValue(){ return count++; } }
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
I like...
posted
Jun 08, 2005 09:22:00
0
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
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter