123456789_123456789_123456789_123456789_123456789_

Module: NIO

Overview

Monitor control how a channel is being waited for by a monitor

Constant Summary

Class Method Summary

  • .engine

    NIO implementation, one of the following (as a string): * select: in pure Ruby using Kernel.select * libev: as a C extension using libev * java: using Java NIO.

  • .pure?(env = ENV) ⇒ Boolean

Class Method Details

.engine

NIO implementation, one of the following (as a string):

  • select: in pure Ruby using Kernel.select
  • libev: as a C extension using libev
  • java: using Java NIO
[ GitHub ]

  
# File 'lib/nio.rb', line 21

def self.engine
  ENGINE
end

.pure?(env = ENV) ⇒ Boolean

[ GitHub ]

  
# File 'lib/nio.rb', line 25

def self.pure?(env = ENV)
  # The user has explicitly opted in to non-native implementation:
  if env["NIO4R_PURE"] == "true"
    return true
  end

  # Native Ruby on Windows is not supported:
  if (Gem.win_platform? && !defined?(JRUBY_VERSION))
    return true
  end

  # M1 native extension is crashing on M1 (arm64):
  # if RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /arm64/
  #   return true
  # end

  return false
end