Sha256: abe663c1427aca97b409d9fc74fa55d3ee57fd555adfde5abf8f16ab68928d02

Contents?: true

Size: 869 Bytes

Versions: 118

Compression:

Stored size: 869 Bytes

Contents

/*
 * backwards compatibility for pre-1.9.3 C API
 *
 * Ruby 1.9.3 provides this API which allows the use of ppoll() on Linux
 * to minimize select() and malloc() overhead on high-numbered FDs.
 */
#ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
#  include <ruby/io.h>
#else
#  define RB_WAITFD_IN  0x001
#  define RB_WAITFD_PRI 0x002
#  define RB_WAITFD_OUT 0x004

static int my_wait_for_single_fd(int fd, int events, struct timeval *tvp)
{
  fd_set fdset;
  fd_set *rfds = NULL;
  fd_set *wfds = NULL;
  fd_set *efds = NULL;

  FD_ZERO(&fdset);
  FD_SET(fd, &fdset);

  if (events & RB_WAITFD_IN)
    rfds = &fdset;
  if (events & RB_WAITFD_OUT)
    wfds = &fdset;
  if (events & RB_WAITFD_PRI)
    efds = &fdset;

  return rb_thread_select(fd + 1, rfds, wfds, efds, tvp);
}

#define rb_wait_for_single_fd(fd,events,tvp) \
        my_wait_for_single_fd((fd),(events),(tvp))
#endif

Version data entries

118 entries across 118 versions & 9 rubygems

Version Path
eventmachine-mkroman-1.3.0.dev.1 ext/wait_for_single_fd.h
wj_eventmachine-1.3.2 ext/wait_for_single_fd.h
wj_eventmachine-1.3.1 ext/wait_for_single_fd.h
wj_eventmachine-1.3.0.dev.1 ext/wait_for_single_fd.h
mysql2-0.4.10-x86-mswin32-60 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.10-x86-mingw32 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.10-x64-mingw32 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.10 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.9-x86-mswin32-60 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.9-x86-mingw32 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.9-x64-mingw32 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.9 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.8-x86-mswin32-60 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.8-x86-mingw32 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.8-x64-mingw32 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.8 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.7-x86-mswin32-60 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.7-x86-mingw32 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.7-x64-mingw32 ext/mysql2/wait_for_single_fd.h
mysql2-0.4.7 ext/mysql2/wait_for_single_fd.h