[concurrency-interest] a volatile bug?

Zhong Yu zhong.j.yu at gmail.com
Wed May 16 12:55:00 EDT 2012


as reported on
http://stackoverflow.com/questions/10620680

basically there are

    volatile int a;
    int b;

Thread 1:

    b=1;
    a=1;

Thread 2:

    while(a==0)
        ;
    if(b==0)
        print("error");

"error" is seen printed on 32 bit JDK6 on 64bit machine


More information about the Concurrency-interest mailing list