Threads & NSTextView
Threads & NSTextView
- Subject: Threads & NSTextView
- From: Laurent Michel <email@hidden>
- Date: Sat, 23 Jul 2005 11:16:11 -0400
Hi!
A quick question... I have an application with two threads:
- The main Cocoa thread
- A compute bound thread.
The compute bound thread periodically wants to update the interface.
At the moment, I am only attempting simple things: drop text into a
'console' implemented with an NSTextView. Since I did not see
NSTextView listed in the thread-safe cocoa objects, I made sure to call
BOOL isLocked = [console lockFocusIfCanDraw];
...
if (isLocked) [console unlockFocus];
around the code that appends the text at the end of the TextStorage
object.
Now every now and then, the application deadlocks and by attaching to
the process, it appears that the lockup always happens inside the
'editing' of the NSTextStorage and the Glyph drawing (in the other
thread).
Now, the main cocoa thread is just running the event loop. Nothing
special overthere.
So, my question...
How does one /properly/ locks an NSTextView to update its content
from a separate thread ? Should I lock the parent view ? How should I
lock ? which API ?
--
Laurent
_______________________________________________
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