[Tux4kids-discuss] [Tuxmath-devel] high cpu usage

David Bruce davidstuartbruce at gmail.com
Sat Mar 12 18:38:33 UTC 2011


Hi,

On Sat, Mar 12, 2011 at 10:54 AM, deepak aggarwal
<deepak.aggarwal9 at gmail.com> wrote:

> Hi David
> When i am working on new server systemthen i encounter a serious problen in
> my program that
>   whenever i run server then either core of my cpu core have 100% usage.
>  I know this is happening because there is a infinite loop in a thread.

Any infinite loop needs to have throttling, which generally is done in
SDL programs with SDL_Delay() so that the loop executes no more than
once every e.g. 10 msec.

t4k_common has a convenience function called T4K_Throttle() for this
purpose, simply because we were writing identical throttling code in
loops throughout the programs.

hth,

David



More information about the Tux4kids-discuss mailing list