• 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: NSImage thread safety
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage thread safety


  • Subject: Re: NSImage thread safety
  • From: Benjohn <email@hidden>
  • Date: Tue, 1 Feb 2005 11:58:24 +0000


On 31 Jan 2005, at 19:18, j o a r wrote:


On 2005-01-31, at 19.47, Benjohn wrote:

I'm trying to sort out a crash in our application. Having turned lots of things off, I'm currently suspicious that it's down to two threads concurrently querying the same NSImage (specificially, asking for its bounds). Can this cause a problem?

"bounds" is not a property of NSImage...

Yes, sorry, I'm actually calling "pixelsWide" and "pixelsHigh" on an NSBitmapImageRep.


Have you read the available documentation for thread safety concerns with Cocoa classes? As a rule of thumb I would say that you should never assume that anything is thread safe unless it's explicitly stated that it is.

*nods* That seems like a useful rule of thumb. It seems odd to me that an non mutating, accessor function (that's already been called many times) could cause a problem, but as the implementation is a black box, I suppose I can't make any assumptions about it at all.


Try to create a test case where you can reproduce the problem. It would be useful to have if you'd like to have more input from the list, or if you would like to contact Apple about it.

Can you remove the crashes completely by locking access to the images by only one thread at a time? How easy is it to reproduce the problem?

I'm about to give locking a go. Currently it is not easy to reproduce the problem. It would be easy enough to build a test case for this specific possibility however.


Thanks,
	Benjohn

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: [Cocoa AS IB] Connecting
  • Next by Date: Re: More NetSocket problems...
  • Previous by thread: Re: [Cocoa AS IB] Connecting
  • Next by thread: Re: More NetSocket problems...
  • Index(es):
    • Date
    • Thread