Re: Loosing threads in cocoa
Re: Loosing threads in cocoa
- Subject: Re: Loosing threads in cocoa
- From: Shaun Wexler <email@hidden>
- Date: Thu, 8 May 2003 17:45:48 -0700
On Thursday, May 8, 2003, at 05:20 PM, sinclair44 wrote:
I've always heard this but have never been told why you shouldn't.
I've got
a worker thread in an app that simply calls [textField
setStringValue:@"DONE"]; right before terminating; is this bad?
For one, I don't think that ATS is thread-safe at all. I experience
collisions when rendering text using CoreGraphics directly within a
worker thread, which occasionally glitches/crashes/deadlocks the main
thread if it's deep into refreshing a view hierarchy and needs to also
render text. AFAIK, this shouldn't happen, and is a bug.
I have pretty good luck updating various AppKit control properties from
secondary threads, but there are certain classes that don't respond to
this very well, so it's better to do it on the main thread, as
prescribed. If you're using 10.2 or greater, substitute this:
[textField performSelectorOnMainThread:@selector(setStringValue:)
withObject:@"DONE" waitUntilDone:NO];
...which lets your worker thread get right back to its business;
quitting, in your case.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
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.