From 9fc25c3015810031acea3d5f0c477fff06019284 Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Sun, 12 Dec 2021 16:09:49 +0100 Subject: [PATCH] Actiual versions of ffi-libc provide FFI::LibC::alarm. ffi-libc<0.1.1 has a bug with sys_errlist, so 0.1.1 required. --- lib/timeout_interrupt.rb | 17 ----------------- timeout-interrupt.gemspec | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/lib/timeout_interrupt.rb b/lib/timeout_interrupt.rb index 5c46ff8..438783a 100644 --- a/lib/timeout_interrupt.rb +++ b/lib/timeout_interrupt.rb @@ -1,23 +1,6 @@ require 'ffi/libc' require 'timeout' -# Provided by ffi-libc-lib and extended by this library, if needed. -# Older version of ffi-libc does not provide {FFI::LibC.alarm} -module FFI - module LibC - # @!method alarm(seconds) - # Sets an alarm. After `seconds` it will send an ALRM-signal to this process. - # - # Predefined alarm will be reset and will forget. - # @note Older implementations of ffi-libc does not provide {alarm}, but we need it. - # So we detect, if it is not provided and attach it. - # @param seconds [0] Clears alarm. - # @param seconds [Integer] How many seconds should be waited, before ALRM-signal should be send? - # @return (nil) - attach_function :alarm, [:uint], :uint unless FFI::LibC.respond_to? :alarm - end -end - # Helper module for `TimeoutInterrupt` # @see TimeoutInterrupt module TimeoutInterruptSingleton diff --git a/timeout-interrupt.gemspec b/timeout-interrupt.gemspec index ccdc70e..bbe276e 100644 --- a/timeout-interrupt.gemspec +++ b/timeout-interrupt.gemspec @@ -26,5 +26,5 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.require_paths = ["lib"] - spec.add_runtime_dependency %q + spec.add_runtime_dependency %q, '>= 0.1.1' end