Path: chuka.playstation.co.uk!news From: "pal" Newsgroups: scee.yaroze.freetalk.english Subject: weird behaviour in vsync callback Date: 20 Feb 2002 14:53:09 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 34 Message-ID: <01c1ba1d$77e99820$57a1933e@pal-s-omnibook> NNTP-Posting-Host: nas-cbv-9-161-87.dial.proxad.net X-Newsreader: Microsoft Internet News 4.70.1155 In the following code x never gets set to 2. I can't understand why. Any idea? Note: the commented out "puts" is here to check that f actually gets executed: if you uncomment it, something gets printed (although not the specified string). I wouldn't expect it to work properly under the constraints of a vsync callback, it's just a test. Oddly, I have some more complex code that does exactly the same thing, but included in my game, and it happens to work properly! pal #include #include int x = 0; void f() { x = 2; //puts("x"); } main() { static int i; printf("%d\n", x); VSyncCallback(f); for (i = 0; i < 3*50; i++) VSync(0); // could be just one time but you're never sure ;) printf("%d\n", x); x = 1; printf("%d\n", x); }