Re: NSThread, drawing and waiting
Re: NSThread, drawing and waiting
- Subject: Re: NSThread, drawing and waiting
- From: Damien Sorresso <email@hidden>
- Date: Wed, 27 Jul 2005 08:07:10 -0500
Did you call ``performSelectorOnMainThread:withObject:" from the worker
thread itself? If so, what calls were in the "tiny method" which
updated the GUI?
--
Damien Sorresso
Macintosh Developer
Computer Infrastructure Support Services
Illinois State University
email@hidden
309.438.5777
On 26 Jul, 2005, at 4:59 PM, Dirk Stegemann wrote:
Hi,
Am 27.07.2005 um 00:33 schrieb Damien Sorresso:
The `RNRequirementManager' has an array of `RNRequirement' items that
it goes through and calls the ``searchForItem" methods for. Here's
what that code looks like.
for( i = 0; i < numResults; i++ ) {
int condition = [[requirementsArr objectAtIndex:i] lockCondition];
[conditionLock lock];
[conditionLock unlockWithCondition:condition];
[NSThread detachNewThreadSelector:@selector(searchForItem)
toTarget:[requirementsArr objectAtIndex:i]
withObject:nil];
[conditionLock lockWhenCondition:0];
[conditionLock unlock];
// Tell delegate what to do
// ...
}
I had pretty much success by spawning a "worker" thread to do the
heavy work; then every time I wanted the GUI being updated using
information created by this worker thread, it used NSObject's
- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg
waitUntilDone:(BOOL)wait;
method to run a tiny method which updates the GUI accordingly.
Regards,
Dirk Stegemann
_______________________________________________
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