Path: chuka.playstation.co.uk!news From: Chris Chadwick Newsgroups: scee.yaroze.programming.libraries Subject: A critical question Date: Wed, 15 Oct 1997 01:03:14 -0700 Organization: PlayStation Net Yaroze (SCEE) Lines: 34 Message-ID: <344478C2.6263@dial.pipex.com> NNTP-Posting-Host: al233.du.pipex.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.02 (Win95; I; 16bit) Hi, Can someone help clear up in my mind the use of the EnterCriticalSection() and ExitCriticalSection() functions. I realize, presumably, the point of entering a critical section is so that a piece of code can be allowed to execute at maximum speed, having surpressed the vsync interrupt. Does this simply mean then that CallBack functions are disabled? What other interrupts etc. are surpressed when calling EnterCriticalSection()? I ask because my experience of running code within a critical section is a bit baffling: The first piece of code I tried it on had to do alot of number crunching (to anti-alias the display image) which took quite a few vsyncs to complete. I got quite a significant speed improvement when running this code in a critical section. I also tried it on a piece of code that handled collision detection - which obviously has to execute within a single vsync - but actual got a degradation in speed. Does this mean I can expect *no* advantage running code in a critical section unless it takes considerably longer than 1 vsync to execute in the first place? And lastly (I promise!), the User Guide says than a program is automatically *in* a critical section when first run!!!!!! Given that most library functions arent supposed to execute reliably if called from a critical section, whats going on? (a typo?) Someone sort my head out, please :) Have I got *totally* the wrong idea about all this? Cheers 4 now, Chris