The best way to handle this, is to detect whether rb_thread_blocking_region is available or not and switch based on that instead of relying on version numbers. In general it's a better approach to test for the availability of certain functionality instead of hard coding dependencies on specific versions.
I don't know if it's at all possible to provide TRAP_BEG / TRAP_END, maybe someone else can weigh in on that.
--
Regards,
Dirkjan
> --
> --- !ruby/object:MailingList
> name: rubinius-dev
> view: http://groups.google.com/group/rubinius-dev?hl=en
> post: rubini...@googlegroups.com
> unsubscribe: rubinius-dev...@googlegroups.com
You can use regular extconf.rb detection mechanisms to check whether
rb_thread_blocking_region is available, so that's definitely the
preferred way to go. You should check how various other projects to
method detection. You can use something very simple like the
following:
have_func('rb_thread_blocking_region')
If you use this in your extconf.rb, you get a Makefile that defines
the appropriate HAVE_RB_THREAD_BLOCKING_REGION define so it will also
work with MRI. Rubinius actually defines
HAVE_RB_THREAD_BLOCKING_REGION manually because it can't be linked as
a shared library, unlike MRI. The shared library linking is used by
extconf for checking whether methods are available.
If you find other methods to be missing in Rubinius, please report an
issue, we want the C-api to be as complete as possible. If you are
able to add specs and the missing method, that would of course be even
more awesome :).
--
Regards,
Dirkjan Bussink