LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-07-2004, 08:33 AM   #1
indian
Member
 
Registered: Aug 2004
Posts: 137

Rep: Reputation: 15
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...
 
Old 09-07-2004, 08:44 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
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?
 
Old 09-07-2004, 08:56 AM   #3
indian
Member
 
Registered: Aug 2004
Posts: 137

Original Poster
Rep: Reputation: 15
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..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gkrellm small problem axelmang Linux - Software 1 11-19-2004 04:26 AM
Small Problem Saudm89 Mandriva 2 09-11-2004 06:51 PM
small problem s9722 Linux - Newbie 4 06-05-2003 07:13 PM
small problem please help me shadowrsr6 Linux - Newbie 4 03-25-2003 07:26 PM
this problem is so small destkid Linux - Newbie 3 10-19-2001 09:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration