> On Dec 31, 2016, at 9:03 PM, Charles Srstka <cocoa...@charlessoft.com> wrote:
> 
>> On Dec 31, 2016, at 7:35 PM, Graham Cox <graham....@bigpond.com 
>> <mailto:graham....@bigpond.com>> wrote:
>> 
>> NSProgress is thread safe and might be useful for this.
> 
> One thing to be careful about when using NSProgress with threads is not to 
> bind directly to it from your UI elements, since the updates will come in on 
> the same thread the changes were made on. Either register your observers 
> manually and call the main thread from 
> -observeValue:forKeyPath:ofObject:change:context:, or have your worker thread 
> call the main thread to update the NSProgress object.

[Just catching up on my e-mail now.]

Yeah, I just read that Cocoa Bindings is generally main-thread only, like the 
windows and views. I thought I could have a NSProgress subclass that takes a 
pointer to an existing progress object, KVO’s the heck out of all the remote 
object's attributes, then updates its own to match, but only posts from the 
main queue. The initializer would take the remote progress object, but it would 
also need the queue that the remote does its work on, so the local progress 
object can pass its cancel/pause/resume up to the remote object, right?

Would I have to KVO every attribute? Or is there a core list so I can use 
Progress’s included code to handle the rest? I’m also thinking of adding a 
Boolean flag to indicate completion. (You can’t use fraction-complete attribute 
since it’s floating-point.)

The “Progress” page has an “isOld” attribute that isn’t documented, also with 
some undocumented publish & subscribe API. Are those a mistake? Or an obsolete 
API (and we should use the documented members)?

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to