itimer 10 → 11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/itimer.rb +10 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4987a91d7f5173e0891c1048c28536157ac91e9
|
4
|
+
data.tar.gz: f29d869ff2bb37bf390a1dc31dbd5726da85d5b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2205c2bf075eaf13f14ad8d416e61c7c56a85b1eeda06afbe7a394798757724644f3ba249186e980479fbbd49fdbe4a06ba28e3fbc62df9724b373eada328485
|
7
|
+
data.tar.gz: 0cb968fdea5a7d268871e878fab01b7f7a8c76f83f068a825cace8e71f654c1a8798c9d8794a5cd7360da5bfad24c618299773289bee6c7dcc4fdb66ecacafc6
|
data/lib/itimer.rb
CHANGED
@@ -21,32 +21,32 @@ module Itimer
|
|
21
21
|
|
22
22
|
catch_name = "itimer_#{@counter}"
|
23
23
|
|
24
|
-
prev_handler = Signal.trap 'ALRM' do
|
25
|
-
begin
|
26
|
-
raise klass
|
27
|
-
rescue klass
|
28
|
-
throw(catch_name, $!)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
24
|
timed_out = true
|
33
25
|
@active_timeout = absolute_timeout
|
34
26
|
|
35
27
|
exception = catch(catch_name) do
|
28
|
+
prev_handler = Signal.trap 'ALRM' do
|
29
|
+
begin
|
30
|
+
raise klass
|
31
|
+
rescue klass
|
32
|
+
throw(catch_name, $!)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
36
|
set(:real, seconds)
|
37
37
|
begin
|
38
38
|
ret = yield
|
39
39
|
timed_out = false
|
40
40
|
ensure
|
41
41
|
@active_timeout = prev_timeout
|
42
|
+
Signal.trap('ALRM', prev_handler)
|
43
|
+
|
42
44
|
now = Time.now
|
43
45
|
if prev_timeout && prev_timeout - now > 0
|
44
46
|
set(:real, prev_timeout - now)
|
45
47
|
else
|
46
48
|
set(:real, 0)
|
47
49
|
end
|
48
|
-
|
49
|
-
Signal.trap('ALRM', prev_handler)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itimer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '11'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Mueller
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
63
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.
|
64
|
+
rubygems_version: 2.4.5
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
67
|
summary: Timeout replacement using POSIX interval timers
|