• 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
Re: Techniques for thread communication
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Techniques for thread communication


  • Subject: Re: Techniques for thread communication
  • From: Dave Camp <email@hidden>
  • Date: Mon, 8 Sep 2003 00:49:18 -0700 (PDT)

On Sun, 7 Sep 2003, Eric Scharff wrote:

> I have a thread that continuously does computationally expensive
> things in the background, but which occasionally needs to
> present information to the user. Since the AppKit is mostly
> not-reentrant, I want to make sure I do this the "right way."
>
> It seems I have several options:
>
> 1. Use the NSNotificationCenter. The thread posts messages when
> data is available, and the main app gets these events and
> updates.

Using notifications to deliver messages to specific threads is documented
in the Cocoa docs included with the 2002 tools update...

Delivering Notifications To Particular Threads
<file:///Developer/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/Notifications/index.html>

It has some example code the in the docs (which I've expanded on for my
use) that is simple and works well. I've used it several apps and I've
found it easier to use than NSConnections (at least for what I need).

Dave
_______________________________________________
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.

References: 
 >Techniques for thread communication (From: Eric Scharff <email@hidden>)

  • Prev by Date: NSTextField question
  • Next by Date: Re: general questions (another noob)
  • Previous by thread: Re: Techniques for thread communication
  • Next by thread: Re: Techniques for thread communication
  • Index(es):
    • Date
    • Thread