GLX Program in a hard loop and using all system resources
Hello, I am writing a program using XLib and GLX (OpenGL) on Linux to draw in the root window. All it is is a slideshow for my desktop. The program launches, grabs the root window, and goes to town... but I have one small problem.
The loop in my main is causing my CPU to be used 100%. This isn't good for a desktop "beautifier"... Is there a way to tell the loop to calm down? Maybe like the Sleep(0) in windows? |
What you are seeing is normal behaviour for a graphics app as this is what is normally wanted ie run as fast as you can. Have a look at usleep or sleep
http://opengroup.org/onlinepubs/0079...sh/usleep.html http://opengroup.org/onlinepubs/0079...xsh/sleep.html |
Quote:
|
Thanks for your help guys. I got it working great with nanosleep... however, nanosleep seams more like it is sleeping for milliseconds than for nanoseconds. Oh well, I tweaked my program to work with what ever it is doing.
|
All times are GMT -5. The time now is 04:34 PM. |