From: Brian Candler Date: 2003-04-25T05:52:53+09:00 Subject: Re: asynchronous ruby 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 :-) Regards, Brian. [*] You should definitely listen to what this man says.