How to send message between thread?
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.