From: spooq Date: 2007-01-04T21:53:43+09:00 Subject: Re: Ruby Cocoa Run Loop On 1/4/07, benjohn@fysh.org wrote: > Spooq: > > On 1/3/07, Benjohn Barnes wrote: > >> I'd like to be able to fire up the NSApplication's run loop from > >> within a new NSThread. > > > > I can't comment on any Mac-specific code, but in my experience mixing > > threading/event models rarely works. Things like select() get > > confused. > > I've realised two things. > > First, I don't know what's going on - I'm reading the big Cocoa > Programming book by Scott Anguish et al, and it's helping. There's lots > about the cocoa / objective c run time interface at the back. I presume > this is how the Ruby Cocoa bridge works. Anyway, it's interesting, and > perhaps it'll help. I suspect that at least one problem is that the Ruby > interpreter is unlikely to be thread safe and re-entrant. Perhaps it is, > I don't know. There are just so many ways and places it could be breaking, I would try not to get involved with any of them :P > Second, starting a thread is just one approach. What I'm after is a > minimal way of: > * Getting the application loop going while also > * Continuing to have IRB interaction. Perhaps you could invert the problem, and put a widget in your app that allowed you to type in code and eval it? You could probably emulate a terminal-style interface without much effort.