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 = ++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?


1 to 1 of 1
1 to 1 of 1