How to use timer in redhat9
I want do somthing periodically.
I want use timer but how to do it. would you give me some idea or examples. anything will be helpful. |
You can use cron to start your program.
Code:
man 5 crontab |
that's good and the program will be start periodically.
but I want do it in the program, that means the program will be start only once. |
Code:
man 3 sleep Code:
man daemon |
I want use somthing like timers.
I give it a period and a function to invoke, then when the time specified by period comes to the end, the function will be invoked automatically. I like this way ,because it make the program logic clear. do you know How to achieve this purpose. |
man alarm
...and... man setitimer |
you can use threads.for example "i=1 to 1000" block takes 1 seconds to complete so that in a thread function,you can control the value (it is i) if equals to 1000,if equals to 1000 you can start a code block you want.
i actually didnt tried this example cos i just learned threads.but i think it will work ; ).(and also i will try by now : ) |
Quote:
|
All times are GMT -5. The time now is 05:47 AM. |