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.
This commit is contained in:
parent
f27600ce16
commit
9fc25c3015
|
@ -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
|
||||
|
|
|
@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
|
|||
spec.require_paths = ["lib"]
|
||||
spec.require_paths = ["lib"]
|
||||
|
||||
spec.add_runtime_dependency %q<ffi-libc>
|
||||
spec.add_runtime_dependency %q<ffi-libc>, '>= 0.1.1'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue