• 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: Thread Safety - A Theoretical Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread Safety - A Theoretical Question


  • Subject: Re: Thread Safety - A Theoretical Question
  • From: Greg Guerin <email@hidden>
  • Date: Mon, 12 Oct 2009 15:28:57 -0700

André Berg wrote:

I am designing my first real class and I am wondering about thread safety.


Thoughts on reading the above:

What do you mean by "real class"? Are the other classes you've designed merely sham classes? Toy classes? Mock classes?

What other classes have you designed?  And implemented?

In what circumstances is this real class going to be used? Are you designing it for your own use or for others?


My class internally doesn't use any threads at all (well apart from an NSTask ivar and readInBackgroundAndNotify).


Thoughts on reading the above:

You're using readInBackgroundAndNotify, which implies a run-loop for correct operation, IIRC. Is that fact documented for your class? Will the class work properly in a run-loop in a non-main thread?

What is the NSTask doing? Is the use of NSTask apparent to users of the class? Is it necessary for users to know this (other than the dependence on run-loop necessitated by readInBackgroundAndNotify)?


And I agree with the other comments: thread safety depends on what the class does, and how it's intended to be used. There isn't one universal answer.


  -- GG


_______________________________________________

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: Thread Safety - A Theoretical Question
      • From: AndrĂ© Berg <email@hidden>
  • Prev by Date: Re: Issue with NSView setFrame
  • Next by Date: [UTI] Anyway to retrieve the UTI of a file without having to use a FSRef?
  • Previous by thread: Re: Thread Safety - A Theoretical Question
  • Next by thread: Re: Thread Safety - A Theoretical Question
  • Index(es):
    • Date
    • Thread