Solved

Equivalent of alram() call in VC++?

Posted on 1998-02-07
6
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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.
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.

707 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