ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Implementing Mutual Exclusion for AJAX
Subject:   Still a race-condition?
Date:   2007-02-16 07:13:01
From:   GICodeWarrior

Have a look at line three of the Command code:
3 this.id = ++Command.NextID;


This entire algorithm hinges on the fact that the 'threads' are uniquely numbered. The line above is where they are numbered. That line is probably not atomic. If that line is not atomic, two 'threads' could end up with the same number.


I don't think it is possible to prove that the above line is atomic because it depends on the interpreter (you could prove it for one interpreter but not all). Therefore, this example would appear to be broken, or am I just nuts?


~Rusty


1 to 1 of 1
  1. Still a race-condition?
    2007-08-30 11:18:28  polyglot [View]

1 to 1 of 1