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

Darwin kqueue #211

Closed
wants to merge 3 commits 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
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.2
TargetRubyVersion: 2.3
DisplayCopNames: true

Layout/SpaceInsideBlockBraces:
Expand Down
10 changes: 2 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ environment:
- RUBY_VERSION: 24-x64
- RUBY_VERSION: 23-x64
- RUBY_VERSION: 23
- RUBY_VERSION: 22

init:
- ps: |
Expand All @@ -23,16 +22,11 @@ init:

install:
- SET RAKEOPT=-rdevkit
- ps: |
if ($env:RUBY_VERSION -eq '_trunk' -or $env:RUBY_VERSION -ge '23' ) {
gem update --system --conservative --no-document
} else {
gem update --system 2.7.9 --conservative --no-document
}
- gem update --system --conservative --no-document
- ruby -v
- gem -v
- bundle -v
- bundle install --path vendor\bundle
- bundle install --path vendor\bundle --without development

test_script:
- bundle exec rake spec
Expand Down
13 changes: 9 additions & 4 deletions ext/libev/ev.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
/* ########## NIO4R PATCHERY HO! ########## */
#include "ruby.h"
#include "ruby/thread.h"

#ifdef __APPLE__
#include <AvailabilityMacros.h>
#endif
/* ######################################## */

/* this big block deduces configuration from config.h */
Expand Down Expand Up @@ -2765,16 +2769,17 @@ ev_recommended_backends (void) EV_NOEXCEPT
{
unsigned int flags = ev_supported_backends ();

#ifndef __NetBSD__
#if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14)
/* apple has a poor track record but post 10.12.2 it seems to work sufficiently well */
#elif defined(__NetBSD__)
/* kqueue is borked on everything but netbsd apparently */
/* it usually doesn't work correctly on anything but sockets and pipes */
flags &= ~EVBACKEND_KQUEUE;
#endif
#ifdef __APPLE__
#else
/* only select works correctly on that "unix-certified" platform */
flags &= ~EVBACKEND_KQUEUE; /* horribly broken, even for sockets */
flags &= ~EVBACKEND_POLL; /* poll is based on kqueue from 10.5 onwards */
#endif

#ifdef __FreeBSD__
flags &= ~EVBACKEND_POLL; /* poll return value is unusable (http://forums.freebsd.org/archive/index.php/t-10270.html) */
#endif
Expand Down
6 changes: 3 additions & 3 deletions lib/nio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ def self.engine
require "nio/monitor"
require "nio/selector"
require "nio/bytebuffer"
NIO::ENGINE = "ruby".freeze
NIO::ENGINE = "ruby"
else
require "nio4r_ext"

if defined?(JRUBY_VERSION)
require "java"
require "jruby"
org.nio4r.Nio4r.new.load(JRuby.runtime, false)
NIO::ENGINE = "java".freeze
NIO::ENGINE = "java"
else
NIO::ENGINE = "libev".freeze
NIO::ENGINE = "libev"
end
end
2 changes: 1 addition & 1 deletion lib/nio/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module NIO
VERSION = "2.4.0".freeze
VERSION = "2.4.0"
end
2 changes: 1 addition & 1 deletion nio4r.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.version = NIO::VERSION

spec.required_ruby_version = ">= 2.2.2"
spec.required_ruby_version = ">= 2.3"

if defined? JRUBY_VERSION
spec.files << "lib/nio4r_ext.jar"
Expand Down