• 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
Threads & NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Threads & NSTextView
      • From: Chris Hanson <email@hidden>
    • Re: Threads & NSTextView
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: Mail.app Blue Sidebar
  • Next by Date: UnEditable OutlineView Cell and Right Click
  • Previous by thread: Re: Swapping toolbars
  • Next by thread: Re: Threads & NSTextView
  • Index(es):
    • Date
    • Thread