Re: NSNotifications between threads
Re: NSNotifications between threads
- Subject: Re: NSNotifications between threads
- From: Milton Sagen <email@hidden>
- Date: Wed, 10 Aug 2005 15:26:48 -0700
Many times I've thought I needed to do something similar but for the
most I usually wanted the notification to be handle on the main
thread. Whenever that was the case I realized I could get what I
needed by simply having the worker thread call
performSelectorOnMainThread:withObject:waitUntilDone: and if the
posting of a notification to the main thread was the objective then
have the routine referenced by selector post it.
Maybe that doesn't help you but many times I've found people over
look performSelectorOnMainThread:...
Milt
On Aug 10, 2005, at 14:50, Damien Sorresso wrote:
In my app, I need a worker thread to continuously update a progress
bar. Basically, it tells it that it's done scanning a directory.
So, in the worker thread, I've set it up to post a notification
with a `userInfo' dictionary.
I've read Apple's docs on the subject posted here:
http://developer.apple.com/documentation/Cocoa/Conceptual/
Notifications/Tasks/Threading.html
I've implemented the threading support in the observer object as
described in the document, but for some reason, the
``handleMachMessage" delegate method is never getting called!
Everything gets initialized So of course, the notifications aren't
getting dispatched to the proper thread. Everything works fine up
until that point. The worker thread is posting the notifications,
and the proper method is getting them in the observer. But they're
not being enqueued correctly.
Also, I've set the progress bar in question to use threaded
animation. Will this cause problems updating it in this fashion?
Any help is greatly appreciated.
--
Damien Sorresso
Macintosh Developer
Computer Infrastructure Support Services
Illinois State University
email@hidden
309.438.5777
_______________________________________________
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
_______________________________________________
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