Re: cocoa-dev digest, Vol 1 #388 - 15 msgs
Re: cocoa-dev digest, Vol 1 #388 - 15 msgs
- Subject: Re: cocoa-dev digest, Vol 1 #388 - 15 msgs
- From: Miguel Morales <email@hidden>
- Date: Mon, 13 Aug 2001 11:33:13 -0700
Dear Kub,
I think you have stumbled upon the following issue: DO network
connections and registration need to be done in the thread in which the
object will run. The reason is that network connections are registered
and handled by the current run loop - where current means whatever run
loop was current when the connections are set up. So if I create a
connection in for myObject in thread 0, and then break it off to run in
thread 1, all network calls are handled by thread 0. If thread 0 is in
a run loop it almost works, but the timing is very screwy because
network calls keep waiting for thread 0 to run. If thread 0 is not in a
run loop (waiting for thread 1 to finish processing?), then the calls
never do get handled properly. So the moral to the story is when doing
DO with multiple threads always set up network connections AFTER you
have broken out the new thread, this way the network connections are
handled by the correct run loop.
-Miguel