Re: [fixed] Knotted Threads
Re: [fixed] Knotted Threads
- Subject: Re: [fixed] Knotted Threads
- From: email@hidden
- Date: Tue, 10 Jun 2003 14:00:56 -0400
On Tuesday, Jun 10, 2003, at 13:40 America/New_York, Buddy Kurz wrote:
>
I'm wondering if maybe your drawFrame method should post an event to
>
the window to trigger the display. I believe that setNeedsDisplay
>
causes the view to be redisplayed at the end of the main event loop
>
but if no event happens what makes it display?
Actually, the thread does not run at all when the control is pressed.
>
Appkit isn't thread safe - is setNeedsDisplay allowed from a separate
>
thread?
I only think that is a problem if you are reading and writing.
>
Also, I think I have read here somewhere that the main event loop gets
>
held up while the mouse is down on a control.
>
hope this helps...
This was exactly the problem, which leads to this:
On Tuesday, Jun 10, 2003, at 13:31 America/New_York, Douglas Davidson
wrote:
>
Move it back onto the main thread. Register the timer for
>
NSEventTrackingRunLoopMode. You can look up run loops, run loop
>
modes, and NSEventTrackingRunLoopMode in the documentation.
In other words:
NSTimer* updateTimer = [NSTimer timerWithTimeInterval: 0.01 target: self
selector: @selector(drawFrame:) userInfo:
nil repeats: YES];
[[NSRunLoop currentRunLoop] addTimer: updateTimer forMode:
NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer: updateTimer forMode:
NSEventTrackingRunLoopMode];
_______________________________________________
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.