Solved

Equivalent of alram() call in VC++?

Posted on 1998-02-07
6
187 Views
Last Modified: 2010-04-10
Hi,

Is there any function call similar to unix alram call in VC++ on Win 95 system. I need to use it to terminate a program which hangs. If not is there a work around for this.
0
Comment
Question by:bagalp
6 Comments
 
LVL 3

Expert Comment

by:q2guo
ID: 1181098
I think raise() is the function you are looking for

<signal.h>
int raise( int sig )

0
 

Author Comment

by:bagalp
ID: 1181099
I want a function call which can be used to time out the program which calls it. Using raise() I will need another process to keep track of this process. raise() is equivalent to a signal() call in UNIX. Here I have a program which potentially hangs. So I need something using which I can time out this program. That is equivalent of alram() call in unix.

Sorry if I was not clear during my first question.
0
 
LVL 7

Expert Comment

by:galkin
ID: 1181100
Create another thread with higher priority which would spy main thread and if it sees main thread has hung it will terminate it.

0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:bagalp
ID: 1181101
Thanks for the work around.

Does this mean that VC++ has no concept of timing out an application.



0
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 1181102
If you need to time out after a specified period of time, use a timer (SetTimer() function).  When the time fires, you application will get a message and you can do whatever it is that needs to be done.  
0
 

Author Comment

by:bagalp
ID: 1181103
OK that's something that will give me some control over the application.

Thanks for your time.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now