Re: Weird Threads (repost)
Re: Weird Threads (repost)
- Subject: Re: Weird Threads (repost)
- From: Chris Meyer <email@hidden>
- Date: Thu, 12 Feb 2004 17:54:19 -0800
You might want to check out
http://developer.apple.com/documentation/Cocoa/Conceptual/
Multithreading/Tasks/appkit.html
Then you might want to restructure your code so that your drawRect:
function is not threaded and draws a cached image.
Generate the cached image in the thread.
On Thursday, February 12, 2004, at 05:33 PM, Sam McCandlish wrote:
I am trying to use an NSThread for a complex drawing operation. In my
custom view, when drawRect is called, I detach to another method in
myself. The view draws fine. The problem is that the app still acts
like it's not multithreaded, the interface still locks up until the
drawing is complete. Any ideas?
Here is the drawRect function:
- (void)drawRect:(NSRect)rect {
[NSThread detachNewThreadSelector:@selector(drawRectThreaded:)
toTarget:self withObject:NSStringFromRect(rect)];
return;
}
The first thread seems stuck in the following while the view is
drawing (this is copied from the debugger)
#0 0x90017048 in semaphore_wait_signal_trap
#1 0x9000e890 in _pthread_cond_wait
#2 0x92dca068 in -[NSViewHierarchyLock lockForWriting]
#3 0x92dd494c in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#4 0x92ded8d0 in -[NSView displayIfNeeded]
#5 0x92dfe598 in -[NSWindow displayIfNeeded]
_______________________________________________
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.
_______________________________________________
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.