Re: DO Proxy
Re: DO Proxy
- Subject: Re: DO Proxy
- From: Brian Webster <email@hidden>
- Date: Tue, 14 May 2002 09:26:30 -0500
On Tuesday, May 14, 2002, at 01:53 AM, cocoa-dev-
email@hidden wrote:
I once tried having a DO connection between several worker
threads and a
main thread, and the main thread had a DO connection to another
process.
The worker threads would send a message to the main thread's proxy,
which would send a message to the other process's proxy. The method got
called, but it never returned - the app would hang here forever unless
the method was oneway void. There didn't seem to be any way to
get it to
work, so I scrapped that model, and just had the other process register
its connection...
Probably what happened here is that DO got confused because you
were sending a message through a proxy whose connection was
registered in a different thread. When you create a connection,
the connection adds its send and receive ports to the run loop
of the thread in which it's been created. It uses these ports
to manage communication between processes or threads. When a
messages is sent over DO, the run loop runs in a special mode
waiting for the reply (i.e. the return value of the method) to
come back over the port.
So, this would cause problems since your worker thread sent the
message, but the ports were registered in a run loop belonging
to your main thread. So, your app was hung waiting for a reply
that would never come back in the correct run loop. Making it
oneway meant that it didn't have to wait for the reply and just
kept on chugging. One solution to this would be to have each of
your worker threads establish its own connection to the remote
object.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.