Re: Async. Notifications in a multi-threaded application
Re: Async. Notifications in a multi-threaded application
- Subject: Re: Async. Notifications in a multi-threaded application
- From: Chris Kane <email@hidden>
- Date: Tue, 31 Dec 2002 20:10:22 -0800
On Thursday, December 19, 2002, at 11:30 AM, Jake Repp wrote:
I have an application that currently is trying to use two threads to
get it's work done. The main thread that launches the application
serves the UI and handles dispatching requests to a shared queue of
commands. These command objects encapsulate all the necessary work that
will be done by a second thread that runs in the background.
The second thread pops threads off of the work queue processes the
request, grabs some XML data from an HTTP server, parses the results of
the request and then posts a notification with the results of the
parsed response.
Well, NSNotificationQueues are not necessarily thread-safe, but I can't
conveniently check the documentation now.
The main question I would have is whether the notifications are not
being received about the time when they are being sent, or are not ever
received. The run loop will need to cycle some before ASAP and Idle
notifications will get pushed out of the queue, and if nothing is
happening on the main thread it might be some time before that happens.
Waiting for your updates until "something else happens" may not be the
behavior you want to get, regardless of what the issue here is. (And if
that's true, then notification queue is not the way to go.)
Chris Kane
Cocoa Frameworks, Apple
_______________________________________________
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.