Issues with multithreaded drawing in Cocoa?
Issues with multithreaded drawing in Cocoa?
- Subject: Issues with multithreaded drawing in Cocoa?
- From: email@hidden
- Date: Wed, 10 Dec 2003 03:03:39 -0500
Greetings,
I'm having this problem in a multithreaded Cocoa app I'm writing in
which multiple successive calls to
- [NSView setNeedsDisplayInRect:]
are not all being drawn.
I made a sample project, but discovered that the problem did not appear
on all machines with the same parameters (though it does on most). What
happens specifically is that if a separate thread is rapidly sending
many distinct setNeedsDisplayInRect messages to the view, in some cases
the rects sent are not drawn.
The problem probably lies in the calling of setNeedsDisplayInRect from
one thread while another thread is in that view's drawRect method. When
this occurs, *sometimes* the area will be marked as needing to be
displayed, and sometimes it won't. Or so it seems.
Any thoughts? I can post the sample code somewhere if it'll be helpful.
Has anyone else experienced the same issue? I don't feel like putting
locks around my drawing code, though if that's what I have to do...
I recall reading in the docs somewhere that Cocoa drawing is
thread-safe. Is there something I'm missing?
Thanks!
J.D. Zamfirescu
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.