• 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
How to send message between thread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to send message between thread?


  • Subject: How to send message between thread?
  • From: email@hidden
  • Date: Thu, 21 Mar 2002 08:20:39 -0700

Hello all,
I have a thread which should run all the time to receive data from another application. I hope it can send message to the main thread when it get data package(data will come quickly, seperately and in a big amount).

I find several ways to send messages, but have some question about them.
1. NSPortMessage:
I may set delegate for the send port and implement handlePortMessage: to do things upon the message in main thread. I wonder when there's large amount of message within short time, will this works well?

2.NSConnection:
I have read Apple's sample code ThrivalThread, it seems client object can send message to server object, but how server object send message to client? Can I just use something like [ ((Controller *)[connectionToController rootProxy]) aMethodInClient:]; in server object?

3. NSNotification:
I'm afraid this solution is not good for large amount of message within short time. I wonder if the notification may be lost or be processed very slow when there's too much messages. I also think this may not absolutely thread safe.

I wonder which solution is the best for my case, and if my guess is correct.

Thanks for any information!

Fei
_______________________________________________
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.

  • Follow-Ups:
    • Re: How to send message between thread?
      • From: Nathan Day <email@hidden>
  • Prev by Date: Re: Does NSSound not work in a Unix tool?
  • Next by Date: Re: isKindOfClass vs. loading bundles: nope?!?!?!?
  • Previous by thread: Re: cocoa-dev digest, Vol 2 #363 - 15 msgs
  • Next by thread: Re: How to send message between thread?
  • Index(es):
    • Date
    • Thread