I am running a Windows dual core system (ran it earlier with a single core windows system, too) with:
Java SE Runtime Environment (build 1.6.0_18-b07)
Java Hotspot Client VM (build 16.0-b13, mixed...
Type: Posts; User: helloworld922
I am running a Windows dual core system (ran it earlier with a single core windows system, too) with:
Java SE Runtime Environment (build 1.6.0_18-b07)
Java Hotspot Client VM (build 16.0-b13, mixed...
hmm... I ran your code (with the zipped java files this time) with that line commented out and left in. Neither case resulted in a thread left hanging indefinately, but only temporarily as it should...
Ah.. I didn't see the zip :P I'll give it another look possible some time tonight.
It looks like you forgot the line of code at the end of your "critical section" that resets the tWantsToEnter for your current thread. See Wikipedia: Peterson's Algorithm.
Why having that printf...