Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to quit app at interrupt time?

Posted on 1997-05-11
2
Medium Priority
?
208 Views
Last Modified: 2013-12-26
null
0
Comment
Question by:danieln
[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
2 Comments
 

Author Comment

by:danieln
ID: 1291457
Edited text of question
0
 
LVL 1

Accepted Solution

by:
PAD earned 600 total points
ID: 1291458
You CAN'T quit an application from an Interrupt routine. This will works in some case but will freez your Mac in the other case.
At interrupt time, you're not sure that the current Heap is your application heap (and in fact often its was not). So as ExitToShell refer to the current application heap...

The best way to do that, i think is to use AppleEvent. You can send to your application a Quit Application event that willbe correctly executed. This a simple and you can find sample code on Apple Dev CD or on internet Apple Dev server.

The only thing to do is to make sure you store the process reference for your appl at beginning and store it in Global so that you can refer to this process serial number at interrupt time to launch an AppleEvent.

Another way is to build a thread that kill your application. And to make it sleep at startup. Then at interrupt time you just have to wake-up this thread, and this thread call exittoshell. You also have to store the global application process serial number.

Good luck...
0

Featured Post

Technology Partners: 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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

715 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