Hello,

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

On 24 Sep 2010, at 10:52, ngollan wrote:

> Hi,
> 
> I'm trying to make the pcap gem work on Rubinius. That gem uses the
> trapping mechanism (TRAP_BEG/TRAP_END) from the 1.8.7 API, which
> Rubinius does not provide; instead, there's the
> rb_thread_blocking_region call from the 1.9 API. Now things get
> complicated, since Rubinius announces RUBY_VERSION 1.8.7, so I cannot
> use the version string for disambiguation.
> 
> For now, it seems to be possible to use the (rbx-specific) RUBY_ENGINE
> constant, but that's not defined in MRI 1.8.x. What I'm doing in
> extconf.rb right now is:
> 
> begin
>  if RUBY_VERSION =~ /^1\.9\./ or RUBY_ENGINE == "rbx"
>    cflags << '-DHAVE_1_9_THREAD_API'
>  end
> rescue NameError
>  # ignore errors trying to accept RUBY_ENGINE
> end
> 
> It would be nice if rbx provided the TRAP_* macros like MRI does, at
> least as long as it announces version 1.8.
> 
> -- 
> --- !ruby/object:MailingList
> name: rubinius-dev
> view: http://groups.google.com/group/rubinius-dev?hl=en
> post: [email protected]
> unsubscribe: [email protected]

-- 
--- !ruby/object:MailingList
name: rubinius-dev
view: http://groups.google.com/group/rubinius-dev?hl=en
post: [email protected]
unsubscribe: [email protected]

Reply via email to