From: Aredridel Date: 2003-04-25T06:46:27+09:00 Subject: Re: asynchronous ruby On Thu, 2003-04-24 at 14:52, Brian Candler wrote: > On Fri, Apr 25, 2003 at 03:32:16AM +0900, daniel wrote > > I have a big dll which is working with sockets and > > so on. > > I'v wrote a wrapping-extension for this dll and there is a > > problem that ruby crash. > > > > the dll has a worker thread which is waiting for > > data. On arrival of some data the thread calls a ruby > > block with > > rb_funcall(block, rb_intern("call"), 1, INT2NUM(n) ); > > If I do this ruby crash. > > > > The callback is asynchronous. > > > > There a two ways: > > - find a way to call the block from this foreign thread > > - poll in a ruby thread. > > > > The second way is very ugly. > > > > Is there a way in ruby to synchronize this? > > Sorry, but Guy[*] has already answered this for you: > http://ruby-talk.org/69913 > > If you don't like the answer you got first time round, simply asking the > question again is unlikely to get the desired result :-) Wouldn't having a ruby-interface thread do the job? Just have the foreign thread call the ruby-interpreter thread, which passes the call to ruby -- right? Aredridel