sorry about the subject but I do not really new how to express what I have in mind. So, what I would like to learn how to do in Linux, is to create a program which will run in the background and every a predefined number of milliseconds it will execute. There are many applications in mind. One such is a reminder. When the clock time / date becomes something then the program reminds you something you have written. I know programs like that exists but I do not know how to do it.
My application is somewhat different. I have written an OpenGL based application when I visualize an object and rotate it around. While I am rotating it, I would like the program to be able every 50-100 msecs to dump .png files on the disk so then I can make a movie out of it to be able to show it to presentations. The reason I need that is because just a few .png files cannot help the audience understand what I am talking about, they have to see the real thing. The best way is to show them short movies. Of course I could make the program rotate automatically and every few steps I could dump a .png file. But this is not what I want since there are some areas I would also like to zoom in e.t.c. You cannot program all of that to be done automatically.
I tried to do a program which in a for loop reads the time using sys/time.h and every 1 second it prints a message, but this eats up 99% of CPU power. This is not what I want. It should behave something like a daemon, and checking the time every few milliseconds should be a very CPU light process. I know that there are many Linux programs which do it, like GmailNotify e.t.c. I do not know though how.
Can anybody help me?
0 · ·