On 9/20/07, Wayne E. Seguin <wayneeseguin / gmail.com> wrote:
>
> On Sep 19, 2007, at 17:56 , hemant wrote:
> > You may be aware but you can use rb_thread_schedule() for letting your
> > Ruby threads run.
>
> hemant,
>
> Actually... no I wasn't.
>
> So if I'm in a C extension and want to let the Ruby continue
> processing can I do this:
>
> - Async Operation
> - rb_thread_schedule()
> - Wait in C ext for async operation to complete (note that this C
> extension is called from within a Ruby thread)
>
> and the C ext would not block the other Ruby threads from that point?

Yes, once you are finished with your Ruby thread and assuming no other
threads are scheduled to run, control will return back to the point in
C extension where you called rb_thread_schedule(). its basically
equivalent of Thread.pass in pure Ruby i suppose.

I hope it helps.


-- 
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org