Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing from secondary thread erases resize corner in window?



On Feb 28, 2008, at 3:18 PM, Hank Heijink wrote:


On Feb 28, 2008, at 2:56 PM, Nate Weaver wrote:

Interesting... I hadn't thought of that. Don't I have to add another timer to the NSDefaultRunLoopMode though? If I have to chose between having two timers on the main thread that alternate, or one on a secondary thread, I think I'll go with the extra thread.

I don't believe so; I've used it in an app of my own with a single timer to avoid the same issue you're having, with no apparent ill effects.


That's not my experience. If I just add a timer for the NSEventTrackingRunLoopMode, the only time that timer fires is when the run loop is in event tracking mode, which is what I would expect. In the NSDefaultRunLoopMode, that timer doesn't fire at all. Are you doing something somewhere else to make this happen, or am I missing something?


How did you create the timer? Via +scheduledTimerWithTimeInterval:... or +timerWithTimeInterval:... ? If you use the latter, you'll have to add it to NSDefaultRunLoopMode yourself. I just do something like:

myTimer = [[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(doTimerStuff:) userInfo:nil repeats:YES] retain];
[[NSRunLoop mainRunLoop] myTimer forMode:NSEventTrackingRunLoopMode];


and it works during both modes (the retain there probably isn't necessary in the general case, either).
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Drawing from secondary thread erases resize corner in window? [solved, for now] (From: Nate Weaver <email@hidden>)
 >Re: Drawing from secondary thread erases resize corner in window? [solved, for now] (From: Hank Heijink <email@hidden>)
 >Re: Drawing from secondary thread erases resize corner in window? [solved, for now] (From: Nate Weaver <email@hidden>)
 >Re: Drawing from secondary thread erases resize corner in window? (From: Hank Heijink <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.