Re: Techniques for thread communication
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.