lwes 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +3 -0
- data/ext/lwes_ext/listener.c +4 -0
- data/ext/lwes_ext/type_conv.c +2 -2
- data/lwes.gemspec +1 -1
- data/test/unit/test_emitter.rb +6 -1
- data/test/unit/test_listener.rb +5 -3
- metadata +3 -3
data/ChangeLog
CHANGED
data/ext/lwes_ext/listener.c
CHANGED
@@ -138,10 +138,14 @@ static VALUE listener_recv(int argc, VALUE *argv, VALUE self)
|
|
138
138
|
args.event = lwes_event_create_no_name(NULL);
|
139
139
|
args.timeout_ms = NIL_P(timeout) ? UINT_MAX : NUM2UINT(timeout);
|
140
140
|
|
141
|
+
retry:
|
141
142
|
saved_errno = errno = 0;
|
142
143
|
r = (int)rb_thread_blocking_region(recv_event, &args, RUBY_UBF_IO, 0);
|
143
144
|
if (r >= 0)
|
144
145
|
return lwesrb_wrap_event(cLWES_Event, args.event);
|
146
|
+
|
147
|
+
if (errno == EINTR)
|
148
|
+
goto retry;
|
145
149
|
saved_errno = errno;
|
146
150
|
(void)lwes_event_destroy(args.event);
|
147
151
|
if (r == -2 && ! NIL_P(timeout))
|
data/ext/lwes_ext/type_conv.c
CHANGED
@@ -35,7 +35,7 @@ LWES_U_INT_32 lwesrb_uint32(VALUE val)
|
|
35
35
|
|
36
36
|
if (tmp != (LWES_U_INT_32)tmp) {
|
37
37
|
const char *s = tmp < 0 ? "negative" : "too big";
|
38
|
-
rb_raise(rb_eRangeError, ":uint32 %s: %
|
38
|
+
rb_raise(rb_eRangeError, ":uint32 %s: %lld", s, tmp);
|
39
39
|
}
|
40
40
|
return (LWES_U_INT_32)tmp;
|
41
41
|
}
|
@@ -46,7 +46,7 @@ LWES_INT_32 lwesrb_int32(VALUE val)
|
|
46
46
|
|
47
47
|
if (tmp != (LWES_INT_32)tmp) {
|
48
48
|
const char *s = tmp < 0 ? "small" : "big";
|
49
|
-
rb_raise(rb_eRangeError, ":int32 too %s: %
|
49
|
+
rb_raise(rb_eRangeError, ":int32 too %s: %lld", s, tmp);
|
50
50
|
}
|
51
51
|
return (LWES_INT_32)tmp;
|
52
52
|
}
|
data/lwes.gemspec
CHANGED
data/test/unit/test_emitter.rb
CHANGED
@@ -35,8 +35,13 @@ class TestEmitter < Test::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_initialize_with_heartbeat
|
38
|
+
l = LWES::Listener.new(@options)
|
38
39
|
heartbeat = @options.merge(:heartbeat => 30)
|
39
|
-
|
40
|
+
e = LWES::Emitter.new(heartbeat)
|
41
|
+
assert_instance_of LWES::Emitter, e
|
42
|
+
assert_nil e.close
|
43
|
+
assert_instance_of LWES::Event, l.recv
|
44
|
+
assert_nil l.close
|
40
45
|
end
|
41
46
|
|
42
47
|
def test_initialize_no_ttl
|
data/test/unit/test_listener.rb
CHANGED
@@ -60,14 +60,15 @@ class TestListener < Test::Unit::TestCase
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_listen_each_signal
|
63
|
-
|
64
|
-
handler = trap(:USR1) {
|
63
|
+
pipe = IO.pipe
|
64
|
+
handler = trap(:USR1) { pipe[1].syswrite('.') }
|
65
65
|
@listener = LWES::Listener.new @options
|
66
66
|
@emitter = LWES::Emitter.new @options
|
67
67
|
tmp = []
|
68
68
|
thr = Thread.new do
|
69
69
|
sleep 0.1
|
70
70
|
Process.kill :USR1, $$
|
71
|
+
assert_equal '.', pipe[0].read(1)
|
71
72
|
@emitter.emit("E1", :hello => "WORLD")
|
72
73
|
:OK
|
73
74
|
end
|
@@ -75,8 +76,9 @@ class TestListener < Test::Unit::TestCase
|
|
75
76
|
assert thr.join
|
76
77
|
assert_equal :OK, thr.value
|
77
78
|
assert_equal 1, tmp.size
|
78
|
-
assert_equal "WORLD", tmp[0].to_hash[:hello]
|
79
|
+
assert_equal "WORLD", tmp[0].to_hash[:hello], tmp
|
79
80
|
ensure
|
80
81
|
trap(:USR1, handler)
|
82
|
+
pipe.each { |io| io.close }
|
81
83
|
end
|
82
84
|
end if LWES::Listener.method_defined?(:recv)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lwes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake-compiler
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project: lwes
|
107
|
-
rubygems_version: 1.8.
|
107
|
+
rubygems_version: 1.8.25
|
108
108
|
signing_key:
|
109
109
|
specification_version: 3
|
110
110
|
summary: Ruby bindings for the Light Weight Event System
|