Re: Knotted Threads
Re: Knotted Threads
- Subject: Re: Knotted Threads
- From: Buddy Kurz <email@hidden>
- Date: Tue, 10 Jun 2003 10:40:20 -0700
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?
Appkit isn't thread safe - is setNeedsDisplay allowed from a separate
thread?
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...
On Tuesday, June 10, 2003, at 09:42 AM, email@hidden wrote:
Earlier I posted a problem in which an NSView was not updating during
a continuous NSSlider drag (to be accurate, it was updating, but new
frames were not being updated by an NSTimer). I then posted that I had
fixed the problem by placing the NSTimer in a separate thread. Now,
for some reason, the user interface (the slider and other buttons
--even those which have no connections) temporarily stop the other
thread when they are pushed pressed on (not even clicked), which
inhibits the updating again. How can I fix this problem once and for
all?
Note: The extra thread is based on a function in the same NSView that
needs
updating, and that same NSView happens to be the controller:
...
[NSThread detachNewThreadSelector: @selector(timerDrawingThread:)
toTarget: self withObject: nil];
...
- (void)timerDrawingThread: (id) argument
{
NSAutoreleasePool* pool = [NSAutoreleasePool new];
[NSTimer scheduledTimerWithTimeInterval: 0.01 target: self
selector: @selector(drawFrame:)
userInfo:nil
repeats: YES];
[[NSRunLoop currentRunLoop] run];
[pool release];
}
...
- (void)drawFrame: (NSTimer*)timer
{
//doesn't actually draw.
[self setNeedsDisplay: YES];
}
_______________________________________________
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.
_______________________________________________
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.