• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSView subclass - expressing the fact that a property affects the displayed image


  • Subject: Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
  • From: Uli Kusterer <email@hidden>
  • Date: Tue, 26 May 2015 10:45:49 +0200

On 23 May 2015, at 10:42, Jonathan Taylor <email@hidden> wrote:
> If only there was a way of annotating properties as only-to-be-used-from-the-main-thread. I've asked something to that effect previously, though, and nobody had any suggestions. I feel there must be a way of designing-in the safety that I need, but I haven't worked out what it might be.

 The closest I got was creating a macro that uses np_thread_main() (or whatever it was called exactly, it’s part of the pthreads API, IIRC) and throws if it’s not the main thread. I call that e.g. in observeValueForKeyPath overrides whenever I make thread-unsafe calls, so I don’t accidentally make a threaded call. You could probably write a macro roughly equivalent to @synthesize that implements this additional behaviour.

 Of course, it’s only a runtime check, but it’s better than nothing. Sure would be fine if the Static Analyzer could be made to understand KVO and threading and complain about such uses.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


_______________________________________________

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
      • From: Jonathan Taylor <email@hidden>
References: 
 >Custom NSView subclass - expressing the fact that a property affects the displayed image (From: Jonathan Taylor <email@hidden>)
 >Re: Custom NSView subclass - expressing the fact that a property affects the displayed image (From: Graham Cox <email@hidden>)
 >Re: Custom NSView subclass - expressing the fact that a property affects the displayed image (From: Jonathan Taylor <email@hidden>)

  • Prev by Date: Re: What is overwriting 'isa' with 0xbaddc0dedeadbead ?
  • Next by Date: Re: Disabling auto-synthesis of property accessors.
  • Previous by thread: Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
  • Next by thread: Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
  • Index(es):
    • Date
    • Thread