Re: NSThread and memory management
Re: NSThread and memory management
- Subject: Re: NSThread and memory management
- From: Luc Heinrich <email@hidden>
- Date: Tue, 3 Jul 2001 07:54:23 +0200
On Monday, July 2, 2001, at 09:28 , Rob Rix wrote:
So, obviously it can send a message to the object in the new thread,
which can call [NSThread exit], but what I want to know is whether or
not this will leak:
Will the autorelease pool and other objects in the spawned thread be
removed when the thread exits?
Send an 'invalidate' message to the sending NSPort of your NSConnection
(on the thread side) or the receive NSPort of your NSConnection (on the
main thread side):
[[theInterthreadConnectionInMainThread receivePort] invalidate];
or
[[theInterthreadConnectionInSpawnedThread sendPort] invalidate];
This will invalidate the connection on the other side of the fence,
causing your thread runloop to peacefully abort and therefore you thread
to exit, calling any regular cleanup code (like [pool release] for
example :-) ) on its way out.
--
Luc - email@hidden