Re: setNeedsDisplay broken in Tiger
Re: setNeedsDisplay broken in Tiger
- Subject: Re: setNeedsDisplay broken in Tiger
- From: Andrew Thompson <email@hidden>
- Date: Wed, 25 May 2005 00:43:11 -0400
On May 24, 2005, at 4:01 PM, Troy Stephens wrote:
On May 24, 2005, at 11:32 AM, Troy Stephens wrote:As Bob Ippolito
pointed out, messaging views from a secondary thread is in general not
thread-safe and therefore not a recommended practice, on any version
of Mac OS X.
To clarify a bit: There _are_ some aspects of view functionality that
are OK to use in a multithreaded manner. For example, locking focus
to draw in a view on a secondary thread is supported.
The -setNeedsDisplay: and -setNeedsDisplayInRect: operations, however,
are not thread-safe, and should therefore always be performed on the
application's main thread.
Interesting contrast with Java AWT, where the repaint() method on
Component is one of the very few AWT/Swing operations which *is*
explicitly thread safe and can be called from any thread.
Of course, they achieve that by queuing repaint events on the AWT event
queue and thus actually firing the paint from the AWT Thread "some time
later" (thus it really is serial, but the application developer can
ignore that). This does allow them to do repaint coalescing to cut down
on unnecessary paints.
How interesting that -setNeedsDisplay: is exactly the opposite; it
would seem a perfect candidate for some kind of queue... I'd love to
know why it's that way :)
AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside
(see you later space cowboy ...)
_______________________________________________
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