Re: How to noify the framework when application closes
Re: How to noify the framework when application closes
- Subject: Re: How to noify the framework when application closes
- From: Andrew Farmer <email@hidden>
- Date: Mon, 16 Jan 2006 12:13:10 -0800
On 16 Jan 06, at 01:06, rohit dhamija wrote:
Hi All,
I have build an framework for accessing the usb bulk
storage device using iokit framework. Multiple
applications can access the device using this framework.
For each application accessing the device, the framework
allocates some memory. Now, I need to free this memory
when ever the application:
a. Closes decently
b. Abnornal termination
This *is* a framework in the sense of a bundle containing
a library and some headers, right? If it's a separate
daemon, skip everything below: if there's some inter-
application communication going on, there's probably some
sort of socket or pipe connecting the processes, which
should notify you when it's closed.
Otherwise:
Are you sure you have to free the memory? Remember that the
entire heap disappears when the application exits, so
there's no point in going through and freeing all the
memory within the heap before then.
The only thing I'm concerned with that you might want to
do in an application like this before terminating would
be to reset the USB devices.
So is there any way that I can notify the framework that
the application has been closed ?
Easy way: require the application to call a method before
quitting.
Hard way: register for a notification to be delivered
when the application is terminating.
Neither of these will notify you when the application
"terminates abnormally"; however, there often isn't a lot
you can do in that case, as the heap may have been damaged
by the application in its death throes.
Is giving notification to the framework through signals
the right way ? If yes, then how ?
No. Signals work for inter-application communication only.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden