[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CS results on Console and X







>> Also someone(bad with rememberuing names) suggested usleep(1) and sleep(0)
every >frame for speed.

>That's usually recommended for programs that otherwise would consume
>100% of
>CPU time.  It gives the kernel the opportunity to schedule other
>critical
>processes.

>It's necessary - but it won't speed your code up at all.

It does tend to produce smoother results, because you can decide where you want
the pause - usually after you flush the screen and would be waiting for the
refresh anyway. Otherwise the kernel will just snatch control from you anyway,
probably where you don't want it to. (Mid draw or something).

ISTR something about processes which yield rather than having to be switched out
of getting higher priority to run again. But I might be wrong there.

Certainly X11 stuff works much better - because if you don't usleep() every
frame, X can't get a look-in to actually refresh the windows...