On Apr 30, 2015, at 19:15 , Graham Cox <[email protected]> wrote:
>
> Well, the docs say:
>
>> This method only has an effect if style returns NSProgressIndicatorBarStyle.
>> If style returns NSProgressIndicatorSpinningStyle, the indicator is always
>> indeterminate, regardless of what you pass to this method.
Yes, they do say that. But as it happens I went to IB (6.3.1). The
“indeterminate” checkbox is right there, and if you uncheck it you get a
clock-style progress indicator. I guess the docs are out of date, though only
by about 4 or 5 major OS X versions. ;)
> The code that schedules the work is:
I don’t have any answers here, just some random thoughts:
— Looking at your code, my intuition says that this smells like a reference
cycle problem, one that leads to queue blockage.
— Don’t use ‘performSelector…’ with ARC, since it typically can’t preserve
memory management correctness across that boundary. It’s uglier but preferable
to get back to the main thread via ‘dispatch_async (dispatch_get_main_queue (),
^{ … });’. There’s an autocompletion snippet for most of this.
— I’m not a big fan of NSOperationQueue. A simple GCD dispatch_async to the
default non-main queue seems more obvious to me. The only reason for using
NSOperationQueue is if you want a parallel operation count other than 1 (i.e.
serial) or “let the system decide” (i.e. the GCD default), provided that the
individual operations don’t block internally, which tends to mess GCD up. Or if
you want to be able to cancel operations, since there’s no API for that in GCD
itself. Or if you want selector-based operations rather than the block-based
ones you’re using.
— For anything to do with blocks running on background GCD threads, you need to
pay attention to the top level autorelease pool, and the place where exceptions
are caught. IIRC, in vanilla GCD, you have to provide these yourself, but I
don’t remember the NSOperation semantics.
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]