David Chisnall wrote: > On 12 Aug 2013, at 03:44, Doug Warren <[email protected]> wrote: > >> backgroundTid = 0; >> [backThread performSelectorInBackground:@selector(run:) >> withObject:backThread]; >> while(backgroundTid == 0) >> sleep(1); >> > > I don't know if this is your issue, however your test relies on undefined > behaviour. In C99, backgroundTid is not volatile and so the compiler is > entirely free to turn this into the equivalent of : > > if (backgroundTid == 0) > while (1) { sleep(1); }
I doubt that your analysis is correct. Sleep is a function call and backgroundTid is a global variable. The compiler cannot (and must not) assume that backgroundTid is not changed during the call to sleep. Wolfgang _______________________________________________ Gnustep-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnustep-dev
