There's a problem in the sense that this statement in threadfunc1()
:
while(!done);
can be implemented by the compiler as something like:
a_register = done;
label:
if (a_register == 0) goto label;
So updates to done
will never be seen.