From 940c0b3cffa7f691620e7890ada15c7519817307 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 20 Dec 2019 01:39:14 +0000 Subject: provide fiddle-based eventfd implementation sleepy_penguin requires a compiler and development headers to install, so it could be a PITA to install for users on distro-provided Ruby. Allow fiddle since it's part of the Ruby standard library since 1.9.2 and users won't have to install anything else. --- lib/dtas.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/dtas.rb') diff --git a/lib/dtas.rb b/lib/dtas.rb index 7e9c0d5..ae2f815 100644 --- a/lib/dtas.rb +++ b/lib/dtas.rb @@ -25,6 +25,14 @@ module DTAS @null ||= File.open('/dev/null', 'r+') end + @libc = nil + def self.libc + @libc ||= begin + require 'fiddle' + Fiddle.dlopen(nil) + end + end + # String#-@ will deduplicate strings when Ruby 2.5 is released (Dec 2017) # https://bugs.ruby-lang.org/issues/13077 if RUBY_VERSION.to_f >= 2.5 -- cgit v1.2.3-24-ge0c7