> > pgEventLoop() blocks your program and processes all events until pgExitEventLoop() 
>is called. pgEventPoll() processes any available events and returns as soon as 
>possible. You shouldn't use "while (1) pgEventPoll()" since that will make your 
>program use 100% of the CPU checking for new events.
> > 
> sure, about that CPU usage you can think of while (1) { pgEventPoll(); 
>usleep(10000); } and it behaves same (just less cpu consiming)
> my point was that pgEventLoop() behaves different than while(1) { pgEventPoll(); 
>usleep(10000); }
> (if you add sleep call to while in the test.c i sent, it will do the same thing)
> 
i have taken a look at the cli_c code. i guess the answer is: because the the 
pgEventLoop flow is:
pgGetEvent
        pgUpdate
        wait for event
pgDispatchEvent
        do stuff in my function
pgGetEvent
        pgUpdate (updates changes my function made)
        wait for event
.....
and the while flow:
pgCheckEvent - no
pgCheckEvent - no
pgCheckEvent - yes => 
        pgGetEvent
                pgUpdate
                wait for event which is here
        pgDispatchEvent
                do stuff in my function
(no pgUpdate for latest changes)
pgCheckEvent - no
.....



-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pgui-devel

Reply via email to