• 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: OmniNetworking and communicating with the main thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OmniNetworking and communicating with the main thread


  • Subject: Re: OmniNetworking and communicating with the main thread
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 26 May 2003 19:20:32 -0700

On Monday, May 26, 2003, at 05:20 PM, Phil Larson wrote:

I searched through mamasam and learned that the OmniNetworking framework is meant to be used in a blocking thread. Then the thread communicates with the main thread when something interesting happens.

However, I couldn't find anything about communicating with the main thread from the networking thread. I know that notifications are sent in the thread of the poster, so that wouldn't work.

What is the best way to communicate from a "helper" thread to the main thread in a Cocoa application?

I can think of three ways of doing this, so take your pick:

1. NSObject's -performSelectorOnMainThread:withObject:waitUntilDone: methods (only works in OS X 10.2 or later)

2. OmniFoundation's -mainThreadPerformSelector methods

3. Use NDRunLoopMessenger[1] to send the message to the run loop (which is in the main thread)

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://dreamless.home.attbi.com/

"Great spirits have always encountered violent opposition from mediocre minds." - Albert Einstein

[1] <http://homepage.mac.com/nathan_day/pages/ source.html#NDRunLoopMessenger>
_______________________________________________
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: 
 >OmniNetworking and communicating with the main thread (From: Phil Larson <email@hidden>)

  • Prev by Date: Re: OmniNetworking and communicating with the main thread
  • Next by Date: Re: Why multi-threading ?
  • Previous by thread: Re: OmniNetworking and communicating with the main thread
  • Next by thread: Re: Why multi-threading ?
  • Index(es):
    • Date
    • Thread