Re: Safely terminating a thread, or the dealloc that doesn't
Re: Safely terminating a thread, or the dealloc that doesn't
- Subject: Re: Safely terminating a thread, or the dealloc that doesn't
- From: Charles Srstka <email@hidden>
- Date: Tue, 16 Mar 2004 00:55:17 -0600
On Mar 15, 2004, at 6:58 PM, Glen Low wrote:
Suppose I have code that does this:
lengthly_operation ();
performSelectorOnMainThread ();
Now during lengthly operation, the main thread might have already
dealloc'ed the object, so that when performSelectorOnMainThread is
called, it is called on a freed object.
Hmm, the way I understood this to work, the object would get retained
when performSelectorOnMainThread was sent to it, and not released until
after it had done its job, so it shouldn't get dealloc'ed until the
perform is finished. But I guess you could whip up a quick experiment
app that would do just this - call performSelectorOnMainThread to some
selector that would take a long time, then release the object in the
other thread, and see if it crashes.
Charles
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.