From: Stephen Brandon <stephen@br...> - 2002-01-04 10:24:50
On Wednesday 12 Dec 2001 11:12 pm, SKoT wrote:
> I dunno wot I did to your code - I put it back as it were pre my latest
> fiddles and fixes, but as the cvs email says, no good. Tracked down
> the cause of my bug to the delegate messaging thread blocking on
> rootProxy call on its end of the connection. The doco says that this
> may happen if the connection doesn't have a "peer", but we just
> created the other end of teh connection in the init method for the
> stream manager!?!?
> I take it all is fine and dandy on linux - as it should be - did you have
> any luck running this on OSX? Do I have an accused machine?
Ok, I had done all my testing for this on MacOSX, since I was using it to get
the play/stop buttons working on Spectro. So it definitely works in Spectro's
case, on MacOSX.
Could you please compile the latest CVS sources of Spectro and confirm that
the stop/play buttons do the expected thing? (The play button should
unhighlight once the sound stops playing IIRC).
What I think is the problem is this though:
According to the NSConnection docs, in order for DO to work, the vended
object must be in a thread with a NSRunLoop running. This is taken for
granted in an AppKit app (if playing from main thread, of course).
From the mailing list, I detect that there could also be problems if the run
loop is blocked in the main thread - I guess there could be several scenarios
where this may happen. But this would seem likely to block the client thread
in the manner which you report.
If running from a thread which has no runloop, one is created quite easily
with the following: [[NSRunLoop currentRunLoop] run];
So SKoT, does any of this sound like it could be the reason for the problem
in your case? If so, could you make the source code available for the tester,
and I'll work out the best way around it.
It's a bit of a bummer that in order to have delegate messages done in this
way we have to rely on NSRunLoops being present, so I'd like to be able to
autodetect the presence/absence of an NSRunLoop before relying on it being
there, or at the very least ascertain what the SndKit requires in this
regard, and document it fully so app authors know what's what.