Hi, I am sorry for not specifying the enough details. I am trying to implement on VS6.0 . Let me give you the info in very basic manner . like ...there is a func called setup() , this function should run only for maxium 10 seconds. The function may finish its work even in 1 second also . If it is exceeding 10 seconds , we should give 5 seconds more time (like latency). So I need to check the time. like I thought while(setup()||sleep(10)) .. but if the control of execution goes to setup method , then sleep won't execute .. and viceversa ... If I can use system time , may I know how this is implemented ? Like system time is a interrupt , so if it got the control to increment time , will it itself goes to sleep or scheduler raises one more interrupt to resume the process which was running before control goes to time. if so , where the scheduler stroes this information . I think PCB is only for process switching not for interrupts . Please correct me if I am wrong.
Thanks Regards, Gopi.k 9884609596. ----- Original Message ---- From: Nico Heinze <[EMAIL PROTECTED]> To: [email protected] Sent: Sunday, 6 January, 2008 3:50:46 PM Subject: [c-prog] Re: timer events every 10 seconds --- In [EMAIL PROTECTED] com, Gopi Krishna Komanduri <gopikomanduri@ ...> wrote: > > Hi Frnds, > I strucked up with some very basic and simple prog. > Could anyone of you please help me out. I need to write a > code in such a way that , The code should call a function > which prints some random number for every 10 seconds. > The issue what I am facing is once the control; goes into > function , initially I can get the starting time. But I > am unable to solve how my system will lemme know after > 10 seconds. I don't want to implement threads concept. > I don't want to ping time for every moment ( for > optimisation purpose) . That requires you to first tell us what OS you work with, what compiler, what IDE. Only then we can give you any educated advice. For example, if you work with a console application for Unix/Linux, then you don't have much of a choice but to implement a multi-threaded application; at least not that I know of. On the other hand, if you work with Windows, then you can simply add a timer to your program which rings every ten seconds; then your main event loop will simply have to react to these messages accordingly. You see, the possible approaches heavily depend on OS and environment. Regards, Nico Meet people who discuss and share your passions. Go to http://in.promos.yahoo.com/groups [Non-text portions of this message have been removed]
