Gopi Krishna Komanduri wrote:
> 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.

If the function should only execute for 10 seconds, then use time(), 
grab the result (t1) and then periodically compare t1 to the latest 
value of time().  If it exceeds 10 seconds, then stop executing the 
function and return.  Not sure why you think you need to use Sleep() 
here.  Still not enough details.  You should probably post your source code.


Additionally, you seem to be or are running the old Borland Turbo C/C++ 
or the Visual Studio 6 compiler suite. These old compilers are outdated 
and non-ANSI C/C++ Standards compliant. Most members of c-prog will 
generally not answer questions involving such compilers and will simply 
tell you to upgrade to a much more modern compiler.

Finding a new compiler is quite easy. c-prog maintains a massive 'Links' 
section on its website. One of those sections is entitled "Compilers 
(free)":

http://tech.groups.yahoo.com/group/c-prog/links/Compilers_000986587674/

There are hundreds of free compilers to choose from. However, there are 
just a handful that are popular, well supported, ANSI Standard, and free:

Microsoft Visual C++ 2008 Express
Bloodshed Dev-C++
MinGW
gcc/g++

C++ compilers are usually backwards-compatible and will also compile C 
code.  Of the compilers listed, Microsoft Visual C++ (including Express) 
currently has the best debugger on the planet - period.  If you are 
learning C/C++, the ability to step through code line by line and see 
what is wrong is invaluable.  Other compiler suites have debuggers but 
aren't nearly as good.


There are two commercial (non-free) compilers worth mentioning as well. 
Compilers that are not free have to provide a LOT of added value to 
justify their cost.

Microsoft Visual Studio 2008 Professional - In general, if you plan on 
doing Microsoft Windows-specific GUI development (e.g. involving COM, 
ATL, MFC, Office, Vista, etc.), this is the development suite to have. 
Many developers enhance the environment with third-party tools such as 
Visual Assist X.  Also, a number of popular open source projects (e.g. 
TortoiseSVN) will completely build only under the latest version of 
Visual Studio Professional.  Be prepared to pay Microsoft prices though.

Comeau C++ - This is the most ANSI Standards compliant compiler in 
existence. Period. And it is available for virtually every modern 
platform. They have an online code compiler so you can see if code that 
doesn't compile under your compiler but should will compile under theirs.


-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to