On Tue, Sep 3, 2013 at 2:39 PM, Jonathan Taylor < jonathan.tay...@glasgow.ac.uk> wrote:
> The primary instance of the object (call it MyParameters) is bound to UI > elements. Changes to the UI will change the values of its properties > (int/bool/double). These changes will take place on the main thread. > 1. Create MyParameters instance on some object on the main thread and call it mainParameters for example. 2. All values are UI related, so, fill them on the main thread. But lock your mainParameters object before. So, on the main thread do this ... @synchronized( myObjectHoldingMyParameters.mainParameters ) { myObjectHoldingMyParameters.mainParameters.X = X; ... } 3. When you do want a copy on any other thread, do this ... MyParamaters *paramsCopy; @synchronized( myObjectHoldingMyParameters.mainParameters ) { paramsCopy = [myObjectHoldingMyParameters.mainParameters copy]; } ... and implement deep copy without locking. It's done via @synchronized. _______________________________________________ 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