TRAP_BEG and TRAP_END are for MRI 1.8.  This is a fallback for if Cool.io
doesn't find the rb_thread_blocking_region() function, which allows it to
make blocking system calls in a multithreaded environment. You'll probably
want to implement rb_thread_blocking_region() instead. I believe 1.9
additionally implements TRAP_BEG and TRAP_END using some C macro magic whic=
h
generates an rb_thread_blocking_region() call.

Beyond that, it's going to need GetOpenFile() and the FPTR_TO_FD() macro.

On Wed, Dec 8, 2010 at 9:56 PM, Charles Oliver Nutter
<headius / headius.com>wrote:

> On Tue, Dec 7, 2010 at 9:56 PM, Tony Arcieri <tony.arcieri / medioh.com>
> wrote:
> > It uses several parts of the MRI C API which I can only assume are
> > unimplemented by JRuby.
>
> I gave it a shot, and it got as far as compiling loop.c:
>
> loop.c: In function =91Coolio_Loop_run_nonblock=92:
> loop.c:277: error: =91TRAP_BEG=92 undeclared (first use in this function)
> loop.c:277: error: (Each undeclared identifier is reported only once
> loop.c:277: error: for each function it appears in.)
> loop.c:279: error: =91TRAP_END=92 undeclared (first use in this function)
> make: *** [loop.o] Error 1
>
> I don't know what TRAP_BEG and TRAP_END do in MRI, but those would be
> the next ones to implement in JRuby's cext support...
>
> https://github.com/jruby/jruby/tree/master/cext/src
>
> - Charlie
>
>


--=20
Tony Arcieri
Medioh! Kudelski