Solved

Equivalent of alram() call in VC++?

Posted on 1998-02-07
6
210 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

803 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