LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   A small problem in C (https://www.linuxquestions.org/questions/programming-9/a-small-problem-in-c-227679/)

indian 09-07-2004 08:33 AM

A small problem in C
 
I want to make a program which shud run for say exact 30 seconds + I want to run few functions at particular instances say printing some name at t=5 seconds than printfing another name at t=15 seconds....How to do this in C....I can use signals but is there any other easy way to do this.I read somewhere that there is some TIME functions in C ...Can somebody help me..With Regards...

itsme86 09-07-2004 08:44 AM

Not unless you put the program to sleep until the time is up or you continuously poll the time to see when to print the message. You'll need to be more specific on what the constraints are. Should your program be doing something else while the timer is running down or is that all the program does, prints a message every 30 seconds?

indian 09-07-2004 08:56 AM

Ya actually I am making a program using multithread and semaphores...now what I have to do is that I have to use some kind of sheduling so that every thread should invoke itself after some arbitrary time which will be get by RAND funtion.And that program shud run for some user input time...say 2 hours...so i those two hours program will run ...it will invole thread by following some rule and than those threads will do somethig..and than after two hours the program will be over...I hope this clears the picture more..if than than please do tell me...And thanks for showing interest..


All times are GMT -5. The time now is 06:34 AM.