Re: setNeedsDisplay broken in Tiger
Re: setNeedsDisplay broken in Tiger
- Subject: Re: setNeedsDisplay broken in Tiger
- From: John Stiles <email@hidden>
- Date: Wed, 25 May 2005 10:33:23 -0700
On May 25, 2005, at 7:00 AM, Andrew Thompson wrote: It's not that way, you're mistaken. Calling setNeedsDisplay: doesn't cause anything to happen immediately either, but it's not safe to call from random threads whenever you want to. Read the docs, when a view is set as needing display, it will be displayed during the next pass of the event loop.
That makes perfect sense, it just leaves me wondering why what's presumably such a simple method wouldn't be thread safe. One wonders if it's an efficiency thing - assuming it's just a boolean flag, then you'll have problems unless NSLock (or possibly volatile) is used to make the changes visible across threads. Or maybe it's something else entirely.
Well, to truly call it "thread safe," you'd need to handle other threads interacting with that HIView at the same time as your code interacts with it--i.e. what if you call setNeedsDisplay while another thread is currently rendering, resizing, moving, or otherwise altering the view? You have to account for anything that might put the NSView object in an unstable state. |
_______________________________________________
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