Skip to content

Commit

Permalink
use rb_thread_fd_select whenever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Feb 10, 2015
1 parent 2ef7674 commit 7ace7a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ext/em.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ SelectData_t::~SelectData_t()
_SelectDataSelect
*****************/

#if defined(HAVE_TBR) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
#if !defined(HAVE_RB_THREAD_FD_SELECT) && (defined(HAVE_TBR) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL))
static VALUE _SelectDataSelect (void *v)
{
SelectData_t *sd = (SelectData_t*)v;
Expand All @@ -894,10 +894,15 @@ SelectData_t::_Select

int SelectData_t::_Select()
{
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
#if defined(HAVE_RB_THREAD_FD_SELECT)
// added in ruby 1.9.2
return rb_thread_fd_select (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv);
#elif defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
// added in ruby 1.9.3
rb_thread_call_without_gvl ((void *(*)(void *))_SelectDataSelect, (void*)this, RUBY_UBF_IO, 0);
return nSockets;
#elif defined(HAVE_TBR)
// added in ruby 1.9.1, deprecated in ruby 2.0.0
rb_thread_blocking_region (_SelectDataSelect, (void*)this, RUBY_UBF_IO, 0);
return nSockets;
#else
Expand Down

0 comments on commit 7ace7a1

Please sign in to comment.