• 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: NSNotifications between threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >NSNotifications between threads (From: Damien Sorresso <email@hidden>)

  • Prev by Date: NSImageView, Focus Ring and Resizing
  • Next by Date: Re: Addressing Relationships in awakeFromInsert
  • Previous by thread: NSNotifications between threads
  • Next by thread: NSImageView, Focus Ring and Resizing
  • Index(es):
    • Date
    • Thread