kgio 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/GIT-VERSION-GEN CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v2.4.0.GIT
4
+ DEF_VER=v2.4.1.GIT
5
5
 
6
6
  LF='
7
7
  '
data/ext/kgio/poll.c CHANGED
@@ -40,8 +40,6 @@ static int retryable(struct poll_args *a)
40
40
 
41
41
  if (a->timeout < 0)
42
42
  return 1;
43
- if (a->timeout == 0)
44
- return 0;
45
43
 
46
44
  clock_gettime(hopefully_CLOCK_MONOTONIC, &ts);
47
45
 
@@ -53,7 +51,9 @@ static int retryable(struct poll_args *a)
53
51
  }
54
52
  a->timeout -= ts.tv_sec * 1000;
55
53
  a->timeout -= ts.tv_nsec / 1000000;
56
- return (a->timeout >= 0);
54
+ if (a->timeout < 0)
55
+ a->timeout = 0;
56
+ return 1;
57
57
  }
58
58
 
59
59
  static int num2timeout(VALUE timeout)
data/test/test_poll.rb CHANGED
@@ -90,4 +90,31 @@ class TestPoll < Test::Unit::TestCase
90
90
  ensure
91
91
  trap(:USR1, orig)
92
92
  end
93
+
94
+ def test_poll_signal_torture
95
+ usr1 = 0
96
+ empty = 0
97
+ nr = 100
98
+ set = { @rd => Kgio::POLLIN }
99
+ trap(:USR1) { usr1 += 1 }
100
+ pid = fork do
101
+ trap(:USR1, "DEFAULT")
102
+ sleep 0.1
103
+ ppid = Process.ppid
104
+ nr.times { Process.kill(:USR1, ppid); sleep 0.05 }
105
+ @wr.syswrite('.')
106
+ exit!(0)
107
+ end
108
+
109
+ assert_nothing_raised do
110
+ empty += 1 until Kgio.poll(set.dup, 100)
111
+ end
112
+ _, status = Process.waitpid2(pid)
113
+ assert status.success?, status.inspect
114
+ assert usr1 > 0, "usr1: #{usr1}"
115
+ rescue Object => err
116
+ p [ :err, err ]
117
+ ensure
118
+ trap(:USR1, "DEFAULT")
119
+ end
93
120
  end if Kgio.respond_to?(:poll)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kgio
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 4
9
- - 0
10
- version: 2.4.0
9
+ - 1
10
+ version: 2.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - kgio hackers
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-05 00:00:00 Z
18
+ date: 2011-05-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: wrongdoc
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  requirements: []
169
169
 
170
170
  rubyforge_project: rainbows
171
- rubygems_version: 1.7.2
171
+ rubygems_version: 1.8.2
172
172
  signing_key:
173
173
  specification_version: 3
174
174
  summary: kinder, gentler I/O for Ruby