sleepy_penguin 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +24 -0
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/LATEST +6 -8
- data/NEWS +10 -0
- data/ext/sleepy_penguin/epoll.c +8 -10
- data/test/test_epoll.rb +27 -0
- metadata +3 -3
data/ChangeLog
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
ChangeLog from http://bogomips.org/sleepy_penguin.git
|
2
2
|
|
3
|
+
commit ee4481de83bb8d208ff99aed9b5fff393115114c
|
4
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
5
|
+
Date: Fri May 20 19:39:58 2011 -0700
|
6
|
+
|
7
|
+
sleepy_penguin 3.0.1 - really avoids EINTR
|
8
|
+
|
9
|
+
One bugfix:
|
10
|
+
|
11
|
+
* epoll: avoid race condition in EINTR checking
|
12
|
+
|
13
|
+
Even if we timeout while getting an EINTR, we'll retry
|
14
|
+
epoll_wait() with a zero timeout like IO.select does in Ruby to
|
15
|
+
avoid raising Errno::EINTR.
|
16
|
+
|
17
|
+
commit 2fb791b331b286f2af86d807028818d493f0f556
|
18
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
19
|
+
Date: Fri May 20 19:34:39 2011 -0700
|
20
|
+
|
21
|
+
epoll: avoid race condition in EINTR checking
|
22
|
+
|
23
|
+
Even if we timeout while getting an EINTR, we'll retry
|
24
|
+
epoll_wait() with a zero timeout like IO.select does in Ruby to
|
25
|
+
avoid raising Errno::EINTR.
|
26
|
+
|
3
27
|
commit 96503a9d386e422ee594f8579a5a76e970c90a6c
|
4
28
|
Author: Eric Wong <normalperson@yhbt.net>
|
5
29
|
Date: Fri May 20 17:15:19 2011 -0700
|
data/GIT-VERSION-FILE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
GIT_VERSION = 3.0.
|
1
|
+
GIT_VERSION = 3.0.1
|
data/GIT-VERSION-GEN
CHANGED
data/LATEST
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
=== sleepy_penguin 3.0.
|
1
|
+
=== sleepy_penguin 3.0.1 - really avoids EINTR / 2011-05-21 02:40 UTC
|
2
2
|
|
3
|
-
|
4
|
-
raises Errno::EINTR.
|
3
|
+
One bugfix:
|
5
4
|
|
6
|
-
|
7
|
-
may be passed to Epoll methods.
|
5
|
+
* epoll: avoid race condition in EINTR checking
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
Even if we timeout while getting an EINTR, we'll retry
|
8
|
+
epoll_wait() with a zero timeout like IO.select does in Ruby to
|
9
|
+
avoid raising Errno::EINTR.
|
12
10
|
|
data/NEWS
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== sleepy_penguin 3.0.1 - really avoids EINTR / 2011-05-21 02:40 UTC
|
2
|
+
|
3
|
+
One bugfix:
|
4
|
+
|
5
|
+
* epoll: avoid race condition in EINTR checking
|
6
|
+
|
7
|
+
Even if we timeout while getting an EINTR, we'll retry
|
8
|
+
epoll_wait() with a zero timeout like IO.select does in Ruby to
|
9
|
+
avoid raising Errno::EINTR.
|
10
|
+
|
1
11
|
=== sleepy_penguin 3.0.0 / 2011-05-21 00:22 UTC
|
2
12
|
|
3
13
|
Epoll#wait always waits the specified amount of time and never
|
data/ext/sleepy_penguin/epoll.c
CHANGED
@@ -319,21 +319,19 @@ static VALUE epwait_result(struct rb_epoll *ep, int n)
|
|
319
319
|
return INT2NUM(n);
|
320
320
|
}
|
321
321
|
|
322
|
-
static int
|
322
|
+
static int epoll_resume_p(uint64_t expire_at, struct rb_epoll *ep)
|
323
323
|
{
|
324
324
|
uint64_t now;
|
325
325
|
|
326
326
|
ep_fd_check(ep);
|
327
|
-
|
327
|
+
|
328
|
+
if (errno != EINTR)
|
328
329
|
return 0;
|
329
|
-
if (ep->timeout
|
330
|
+
if (ep->timeout < 0)
|
330
331
|
return 1;
|
331
|
-
|
332
332
|
now = now_ms();
|
333
|
-
|
334
|
-
|
335
|
-
ep->timeout = (int)(expire_at - now);
|
336
|
-
return 0;
|
333
|
+
ep->timeout = now > expire_at ? 0 : (int)(expire_at - now);
|
334
|
+
return 1;
|
337
335
|
}
|
338
336
|
|
339
337
|
#if defined(HAVE_RB_THREAD_BLOCKING_REGION)
|
@@ -350,9 +348,9 @@ static VALUE real_epwait(struct rb_epoll *ep)
|
|
350
348
|
int n;
|
351
349
|
uint64_t expire_at = ep->timeout > 0 ? now_ms() + ep->timeout : 0;
|
352
350
|
|
353
|
-
do
|
351
|
+
do
|
354
352
|
n = (int)rb_sp_fd_region(nogvl_wait, ep, ep->fd);
|
355
|
-
|
353
|
+
while (n == -1 && epoll_resume_p(expire_at, ep));
|
356
354
|
|
357
355
|
return epwait_result(ep, n);
|
358
356
|
}
|
data/test/test_epoll.rb
CHANGED
@@ -139,6 +139,7 @@ class TestEpoll < Test::Unit::TestCase
|
|
139
139
|
pid = fork do
|
140
140
|
sleep 0.5 # slightly racy :<
|
141
141
|
Process.kill(:USR1, Process.ppid)
|
142
|
+
exit!(0)
|
142
143
|
end
|
143
144
|
time[:START_WAIT] = Time.now
|
144
145
|
assert_nothing_raised do
|
@@ -397,4 +398,30 @@ class TestEpoll < Test::Unit::TestCase
|
|
397
398
|
end
|
398
399
|
assert_nil thr.value
|
399
400
|
end if RUBY_VERSION == "1.9.3"
|
401
|
+
|
402
|
+
def test_epoll_wait_signal_torture
|
403
|
+
usr1 = 0
|
404
|
+
empty = 0
|
405
|
+
nr = 1000
|
406
|
+
@ep.add(@rd, Epoll::IN)
|
407
|
+
tmp = []
|
408
|
+
trap(:USR1) { usr1 += 1 }
|
409
|
+
pid = fork do
|
410
|
+
trap(:USR1, "DEFAULT")
|
411
|
+
sleep 0.1
|
412
|
+
ppid = Process.ppid
|
413
|
+
nr.times { Process.kill(:USR1, ppid); sleep 0.01 }
|
414
|
+
@wr.syswrite('.')
|
415
|
+
exit!(0)
|
416
|
+
end
|
417
|
+
while tmp.empty?
|
418
|
+
assert_nothing_raised { @ep.wait(nil, 100) { |flags,obj| tmp << obj } }
|
419
|
+
empty += 1
|
420
|
+
end
|
421
|
+
_, status = Process.waitpid2(pid)
|
422
|
+
assert status.success?, status.inspect
|
423
|
+
assert usr1 > 0, "usr1: #{usr1}"
|
424
|
+
ensure
|
425
|
+
trap(:USR1, "DEFAULT")
|
426
|
+
end
|
400
427
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sleepy_penguin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 1
|
10
|
+
version: 3.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- sleepy_penguin hackers
|