Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow compilation of EM on MagLev #241

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/em.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ bool EventMachine_t::_RunEpollOnce()

timeval tv = _TimeTilNextEvent();

#ifdef BUILD_FOR_RUBY
#if defined(BUILD_FOR_RUBY) && !defined(BUILD_FOR_MAGLEV)
int ret = 0;
fd_set fdreads;

Expand Down Expand Up @@ -596,7 +596,7 @@ bool EventMachine_t::_RunKqueueOnce()
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = tv.tv_usec * 1000;

#ifdef BUILD_FOR_RUBY
#if defined(BUILD_FOR_RUBY) && !defined(BUILD_FOR_MAGLEV)
int ret = 0;
fd_set fdreads;

Expand Down Expand Up @@ -654,7 +654,7 @@ bool EventMachine_t::_RunKqueueOnce()
}

// TODO, replace this with rb_thread_blocking_region for 1.9 builds.
#ifdef BUILD_FOR_RUBY
#if defined(BUILD_FOR_RUBY) && !defined(BUILD_FOR_MAGLEV)
if (!rb_thread_alone()) {
rb_thread_schedule();
}
Expand Down
7 changes: 5 additions & 2 deletions ext/em.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ See the file COPYING for complete licensing information.
#ifndef __EventMachine__H_
#define __EventMachine__H_

#ifdef BUILD_FOR_RUBY
#include <ruby.h>
#if defined(BUILD_FOR_RUBY)
#include <ruby.h>
#endif

#if defined(BUILD_FOR_RUBY) && !defined(BUILD_FOR_MAGLEV)
#define EmSelect rb_thread_select

#if defined(HAVE_RBTRAP)
Expand Down
4 changes: 4 additions & 0 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def manual_ssl_config

# Minor platform details between *nix and Windows:

if defined? RUBY_ENGINE and RUBY_ENGINE =~ /maglev/
add_define 'BUILD_FOR_MAGLEV'
end

if RUBY_PLATFORM =~ /(mswin|mingw|bccwin)/
GNU_CHAIN = $1 == 'mingw'
OS_WIN32 = true
Expand Down
4 changes: 4 additions & 0 deletions ext/rubymain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,11 @@ static VALUE t_invoke_popen (VALUE self, VALUE cmd)
for (int i=0; i < len; i++) {
VALUE ix = INT2FIX (i);
VALUE s = rb_ary_aref (1, &ix, cmd);
#ifdef BUILD_FOR_MAGLEV
strings[i] = (char*)StringValuePtr (s);
#else
strings[i] = StringValuePtr (s);
#endif
}
strings[len] = NULL;

Expand Down