LINUX programming

Moderators: ITA
Number of threads: 1347
Number of posts: 2935

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
a program which waits and executes every 0.1 seconds Posted by archwndas on 13 Aug 2008 at 6:01 AM
Hi,
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?



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.