sysvmq 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/ext/sysvmq.c +3 -3
- data/sysvmq.gemspec +1 -1
- data/test/sysv_mq_test.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 328760516c12510088525cd9826745db77023e86
|
4
|
+
data.tar.gz: fdf3c3f4f43d10a5cfa0f55fd4733ed75d8bd810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaac6f14803ef7dfa56adde984e003e4cafc60761364351663b49e5a9a816aa8a4461e6ba85b0e997209fa95cb8cdc11b73d750aca69e5d02682a2f1cac77ef3
|
7
|
+
data.tar.gz: 326f9e82a5a91ce805fa4e864b5b0837dee7095553e65792945ac31d38885c09477abc36252238d1ebe66253edd99b28b668db25954281f0d18f9b7e7b23089b
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# sysvmq
|
1
|
+
# sysvmq [](https://travis-ci.org/Sirupsen/sysvmq)
|
2
2
|
|
3
3
|
`sysvmq` is a C extension that wraps SysV IPC Message Queues. It's similar to
|
4
4
|
the [POSIX MQ Ruby wrapper](https://github.com/Sirupsen/posix-mqueue). Message
|
@@ -7,13 +7,16 @@ take down either endpoint easily. The main disadvantage of SysV message queues
|
|
7
7
|
over POSIX MQs (on Linux) is that SysV doesn't expose a file descriptor to do
|
8
8
|
e.g. `select(2)` on.
|
9
9
|
|
10
|
+
Note that `sysvmq` doesn't rely on any third-party message broker. The message
|
11
|
+
queue is handled by the kernel. It's extremely stable and performant.
|
12
|
+
|
10
13
|
## Installation
|
11
14
|
|
12
15
|
Add `sysvm` to your Gemfile.
|
13
16
|
|
14
17
|
`gem 'sysvmq'`
|
15
18
|
|
16
|
-
Currently known to work on Linux
|
19
|
+
Currently known to work on Linux and OS X for MRI >= 2.0.
|
17
20
|
|
18
21
|
## Usage
|
19
22
|
|
data/ext/sysvmq.c
CHANGED
@@ -74,7 +74,7 @@ sysvmq_alloc(VALUE klass)
|
|
74
74
|
sysv->key = 0;
|
75
75
|
sysv->id = -1;
|
76
76
|
sysv->buffer_size = 0;
|
77
|
-
sysv->msgbuf =
|
77
|
+
sysv->msgbuf = NULL;
|
78
78
|
|
79
79
|
return obj;
|
80
80
|
}
|
@@ -216,7 +216,7 @@ sysvmq_receive(int argc, VALUE *argv, VALUE self)
|
|
216
216
|
rb_sys_fail("Failed recieving message from queue");
|
217
217
|
}
|
218
218
|
} else {
|
219
|
-
// msgrcv(2) can block sending a message, if IPC_NOWAIT is not passed.
|
219
|
+
// msgrcv(2) can block sending a message, if IPC_NOWAIT is not passed.
|
220
220
|
// We unlock the GVL waiting for the call so other threads (e.g. signal
|
221
221
|
// handling) can continue to work. Sets `length` on `blocking` with the size
|
222
222
|
// of the message returned.
|
@@ -305,7 +305,7 @@ sysvmq_send(int argc, VALUE *argv, VALUE self)
|
|
305
305
|
rb_sys_fail("Failed sending message to queue");
|
306
306
|
}
|
307
307
|
} else {
|
308
|
-
// msgsnd(2) can block waiting for a message, if IPC_NOWAIT is not passed.
|
308
|
+
// msgsnd(2) can block waiting for a message, if IPC_NOWAIT is not passed.
|
309
309
|
// We unlock the GVL waiting for the call so other threads (e.g. signal
|
310
310
|
// handling) can continue to work.
|
311
311
|
while (rb_thread_call_without_gvl(sysvmq_maybe_blocking_send, &blocking, RUBY_UBF_IO, NULL) == NULL
|
data/sysvmq.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "sysvmq"
|
7
|
-
spec.version = '0.1.
|
7
|
+
spec.version = '0.1.1'
|
8
8
|
spec.authors = ["Simon Eskildsen"]
|
9
9
|
spec.email = ["sirup@sirupsen.com"]
|
10
10
|
spec.summary = %q{Ruby wrapper for SysV Message Queues}
|
data/test/sysv_mq_test.rb
CHANGED
@@ -89,7 +89,7 @@ class SysVMQTest < MiniTest::Unit::TestCase
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def test_responds_to_sigint
|
92
|
-
pid = fork {
|
92
|
+
pid = fork {
|
93
93
|
begin
|
94
94
|
mq = SysVMQ.new(0xDEADCAFE, 2048, SysVMQ::IPC_CREAT | 0660)
|
95
95
|
mq.receive
|
@@ -117,4 +117,10 @@ class SysVMQTest < MiniTest::Unit::TestCase
|
|
117
117
|
@mq.send(message, 1, SysVMQ::IPC_NOWAIT)
|
118
118
|
assert_equal message, @mq.receive(0, SysVMQ::IPC_NOWAIT)
|
119
119
|
end
|
120
|
+
|
121
|
+
def test_string_key_and_gc
|
122
|
+
assert_raises TypeError do
|
123
|
+
SysVMQ.new("0xDEADC0DE", @size, SysVMQ::IPC_CREAT | 0666)
|
124
|
+
end
|
125
|
+
end
|
120
126
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sysvmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Eskildsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|