Re: multithreading textviews
Re: multithreading textviews
- Subject: Re: multithreading textviews
- From: Cornelius <email@hidden>
- Date: Thu, 22 Nov 2001 13:57:04 +0100
Thank you John and Drew
I will go through NSThread and NSAutoReleasePool and of course the java
bridge
The solution beckons just beyond the horizon.
Cornelius
On Donnerstag, November 22, 2001, at 10:37 Uhr, John C. Randolph wrote:
On Thursday, November 22, 2001, at 12:40 AM, Drew McCormack wrote:
In Cocoa/Obj-C, an NSAutoReleasePool does the garbage collecting (to
use your native java terminology). It updates the retain count
(reference count) of each object which has been 'autoreleased' in the
past event loop iteration. If the count hits zero, the object is
deallocated. The thing you need to realize is that each thread needs
to have its own autorelease pool.
This isn't quite accurate. Objects keep their own retain count,
whether or not there's an autorelease pool in place. The autorelease
pool is nothing more than a means to queue up -release messages that
will be sent whenever the pool is released.
Each thread needs its own autorelease pool *if* anything in that thread
is going to call -autorelease. This isn't always the case: for
example, you might spawn a thread that runs a straight C function that
doesn't make use of any Foundation Kit classes.
-jcr
"This is not a book to be tossed aside lightly. Rather, it should be
hurled with great force." -Dorothy Parker