posix_mq 2.2.0 → 2.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd61a0174a8b5bc70e3c7f7dba0a3192ed5c3a4f
4
- data.tar.gz: 33d0325cd7b5804755ef3ab663e71acaa22d4171
3
+ metadata.gz: df411b34002c2ef4be24cd08c876f27d36e1902e
4
+ data.tar.gz: b3bb9d8ade45215ec378ffaef6a8e26a43c15801
5
5
  SHA512:
6
- metadata.gz: df3e903bd7fcd24583a3a7202d565ba83963974d071dc5a292ad3451324ed95e538ad20a50552cc5a3c28c9680cbe3d736be82fd6d975b9a308f94899d28759a
7
- data.tar.gz: 06c68326b0514f8ca43d2ade5621bee95d62f11526779715f6b1a0732e01c038fe906c58c8b887aa09cb7034ce97c957227f051743fd5a5fae599c14c4934679
6
+ metadata.gz: 6c2520418f996810ba8100fbefad750726dd05d32fa7cebc6ebc875283282c2aefa0eeee16c88e0f91b33e237ac8f2a6faba5be781869765926b1e3b40cf46c3
7
+ data.tar.gz: ffcaeeaede515f86b9348956bc40462d357b617ae76ca66d49eef358a9e43035e5aeeffb4d18f8285345a92e141f82b23bc9387485cd8e4f785bb6ff742cf1bf
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.2.0
4
+ DEF_VER=v2.3.0
5
5
 
6
6
  LF='
7
7
  '
data/README CHANGED
@@ -92,13 +92,12 @@ from processes that receive.
92
92
 
93
93
  You can get the latest source via git from the following locations:
94
94
 
95
- git://bogomips.org/ruby_posix_mq.git
96
- git://repo.or.cz/ruby_posix_mq.git (mirror)
95
+ git://bogomips.org/ruby_posix_mq.git
96
+ git://repo.or.cz/ruby_posix_mq.git (mirror)
97
97
 
98
- You may browse the code from the web and download the latest snapshot
99
- tarballs here:
98
+ You may also browse the code from the web:
100
99
 
101
- * http://bogomips.org/ruby_posix_mq.git (cgit)
100
+ * http://bogomips.org/ruby_posix_mq.git
102
101
  * http://repo.or.cz/w/ruby_posix_mq.git (gitweb)
103
102
 
104
103
  Inline patches (from "git format-patch") to the mailing list are
@@ -107,8 +106,11 @@ the patch.
107
106
 
108
107
  We will adhere to mostly the same conventions for patch submissions as
109
108
  git itself. See the Documentation/SubmittingPatches document
110
- distributed with git on on patch submission guidelines to follow. Just
111
- don't email the git mailing list or maintainer with Ruby posix_mq patches.
109
+ distributed with git on patch submission guidelines to follow:
110
+
111
+ https://git.kernel.org/cgit/git/git.git/plain/Documentation/SubmittingPatches
112
+
113
+ Just don't mail the git list or maintainer with Ruby posix_mq patches.
112
114
 
113
115
  == Contact
114
116
 
@@ -119,40 +121,9 @@ Send patches (from "git format-patch") with "git send-email" and do not
119
121
  send HTML email or attachments. We are very responsive to email and you
120
122
  will usually get a response within 24-72 hours.
121
123
 
122
- == Mailing List Archives
123
-
124
- We operate a {public-inbox}[http://public-inbox.org/] which
125
- feeds the mailing list. You may subscribe either using
126
- {ssoma}[http://ssoma.public-inbox.org/] or by sending a mail
127
- to mailto:ruby-posix-mq+subscribe@bogomips.org
128
-
129
- ssoma is a mail archiver/fetcher using git. It operates in a similar
130
- fashion to tools such as slrnpull, fetchmail, or getmail. ssoma
131
- subscription instructions:
132
-
133
- URL=git://bogomips.org/ruby-posix-mq
134
- LISTNAME=ruby-posix-mq
135
-
136
- # to initialize a maildir (this may be a new or existing maildir,
137
- # ssoma will not touch existing messages)
138
- # If you prefer mbox, use mbox:/path/to/mbox as the last argument
139
- # You may also use imap://$MAILSERVER/INBOX for an IMAP account
140
- # or imaps:// for an IMAPS account, as well.
141
- ssoma add $LISTNAME $URL maildir:/path/to/maildir
142
-
143
- # read with your favorite MUA (only using mutt as an example)
144
- mutt -f /path/to/maildir # (or /path/to/mbox)
145
-
146
- # to keep your mbox or maildir up-to-date, periodically run:
147
- ssoma sync $LISTNAME
148
-
149
- # your MUA may modify and delete messages from the maildir or mbox,
150
- # this does not affect ssoma functionality at all
151
-
152
- # to sync all your ssoma subscriptions
153
- ssoma sync
124
+ Subscription is optional: mailto:ruby-posix-mq+subscribe@bogomips.org
154
125
 
155
- # You may wish to sync in your cronjob
156
- ssoma sync --cron
126
+ Read-only mail archives are available over HTTP and NNTP:
157
127
 
158
- * Mailing list archives: http://bogomips.org/ruby-posix-mq/
128
+ http://bogomips.org/ruby-posix-mq/
129
+ nntp://news.public-inbox.org/inbox.comp.lang.ruby.posix-mq
data/bin/posix-mq-rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- encoding: binary -*-
3
+ # -*- frozen_string_literal: true -*-
3
4
  $stderr.sync = $stdout.sync = true
4
5
  $stdout.binmode
5
6
  $stderr.binmode
@@ -100,7 +101,7 @@ begin
100
101
  when :create
101
102
  exit
102
103
  when :receive
103
- buf, prio = mq.receive("", timeout)
104
+ buf, prio = mq.receive(nil, timeout)
104
105
  $stderr.write("priority=#{prio}\n") if priority
105
106
  $stdout.write(buf)
106
107
  when :send
@@ -14,4 +14,15 @@ have_library("pthread")
14
14
  have_func("__mq_oshandle")
15
15
  have_func("mq_timedsend")
16
16
  have_func("mq_timedreceive")
17
+
18
+ r, w = IO.pipe
19
+ r.close
20
+ w.close
21
+ begin
22
+ r.close
23
+ $CPPFLAGS += ' -DIDEMPOTENT_IO_CLOSE=1'
24
+ rescue IOError
25
+ $CPPFLAGS += ' -DIDEMPOTENT_IO_CLOSE=0'
26
+ end
27
+
17
28
  create_makefile("posix_mq_ext")
@@ -824,7 +824,15 @@ static VALUE setattr(VALUE self, VALUE astruct)
824
824
  */
825
825
  static VALUE _close(VALUE self)
826
826
  {
827
- struct posix_mq *mq = get(self, 1);
827
+ struct posix_mq *mq;
828
+
829
+ if (IDEMPOTENT_IO_CLOSE) { /* defined in extconf.rb */
830
+ mq = get(self, 0);
831
+ if (!mq || (mq->des == MQD_INVALID))
832
+ return Qnil;
833
+ } else {
834
+ mq = get(self, 1);
835
+ }
828
836
 
829
837
  if (! MQ_IO_CLOSE(mq)) {
830
838
  if (mq_close(mq->des) < 0)
data/lib/posix_mq.rb CHANGED
@@ -1,4 +1,4 @@
1
- # -*- encoding: binary -*-
1
+ # -*- frozen_string_literal: true -*-
2
2
  #
3
3
  # This class represents an POSIX message queue descriptor (mqd_t)
4
4
  # object. It matches the C API for POSIX messages queues closely.
@@ -79,7 +79,6 @@ class POSIX_MQ
79
79
  # All send/receive operations are atomic and only one
80
80
  # native thread may be notified at a time
81
81
  alias clone dup
82
-
83
82
  end
84
83
 
85
84
  require 'posix_mq_ext'
data/pkg.mk CHANGED
@@ -86,7 +86,7 @@ fix-perms:
86
86
  gem: $(pkggem)
87
87
 
88
88
  install-gem: $(pkggem)
89
- gem install $(CURDIR)/$<
89
+ gem install --local $(CURDIR)/$<
90
90
 
91
91
  $(pkggem): manifest fix-perms
92
92
  gem build $(rfpackage).gemspec
@@ -1,4 +1,5 @@
1
1
  # -*- encoding: binary -*-
2
+ # frozen_string_literal: true
2
3
  require 'test/unit'
3
4
  require 'thread'
4
5
  require 'fcntl'
@@ -68,7 +69,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
68
69
  @mq = POSIX_MQ.new(@path, :rw)
69
70
  assert ! @mq.nonblock?
70
71
  t0 = Time.now
71
- maybe_timeout { @mq.receive "", interval } or return
72
+ maybe_timeout { @mq.receive nil, interval } or return
72
73
  elapsed = Time.now - t0
73
74
  assert_operator elapsed, :>, interval, elapsed.inspect
74
75
  assert_operator elapsed, :<, 0.04, elapsed.inspect
@@ -82,7 +83,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
82
83
  @mq = POSIX_MQ.new(@path, :rw)
83
84
  assert ! @mq.nonblock?
84
85
  t0 = Time.now
85
- maybe_timeout { @mq.receive "", interval } or return
86
+ maybe_timeout { @mq.receive nil, interval } or return
86
87
  elapsed = Time.now - t0
87
88
  assert_operator elapsed, :>=, 0.01, elapsed.inspect
88
89
  assert_operator elapsed, :<=, 0.04, elapsed.inspect
@@ -93,7 +94,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
93
94
  @mq = POSIX_MQ.new(@path, :rw)
94
95
  assert ! @mq.nonblock?
95
96
  t0 = Time.now
96
- maybe_timeout { @mq.receive "", interval } or return
97
+ maybe_timeout { @mq.receive nil, interval } or return
97
98
  elapsed = Time.now - t0
98
99
  assert elapsed >= interval, elapsed.inspect
99
100
  assert elapsed < 1.10, elapsed.inspect
@@ -151,7 +152,21 @@ class Test_POSIX_MQ < Test::Unit::TestCase
151
152
  assert_equal true, mq.send("HI", 0)
152
153
  assert_equal 1, mq.attr.curmsgs
153
154
  assert_nil mq.close
154
- assert_raises(IOError) { mq.close }
155
+
156
+ r, w = IO.pipe
157
+ w.close
158
+ r.close
159
+ idempotent_close = begin
160
+ r.close
161
+ true
162
+ rescue IOError
163
+ false
164
+ end
165
+ if idempotent_close
166
+ 2.times { assert_nil mq.close }
167
+ else
168
+ assert_raises(IOError) { mq.close }
169
+ end
155
170
  end
156
171
  assert @mq.closed?
157
172
  @mq = nil
@@ -159,7 +174,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
159
174
  end
160
175
 
161
176
  def test_name
162
- path = "" << @path.dup
177
+ path = @path.dup
163
178
  path.freeze
164
179
  @mq = POSIX_MQ.new @path, IO::CREAT|IO::WRONLY, 0666
165
180
  assert_equal path, @mq.name
@@ -192,7 +207,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
192
207
  end
193
208
 
194
209
  def test_shift_buf
195
- buf = ""
210
+ buf = "".dup
196
211
  @mq = POSIX_MQ.new @path, IO::CREAT|IO::RDWR, 0666
197
212
  @mq << "hello"
198
213
  assert_equal "hello", @mq.shift(buf)
@@ -206,7 +221,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
206
221
  end
207
222
 
208
223
  def test_send_receive_buf
209
- buf = ""
224
+ buf = "".dup
210
225
  @mq = POSIX_MQ.new @path, IO::CREAT|IO::RDWR, 0666
211
226
  assert_equal true, @mq.send("hello", 0)
212
227
  assert_equal [ "hello", 0 ], @mq.receive(buf)
@@ -236,7 +251,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
236
251
  end if POSIX_MQ.method_defined?(:to_io)
237
252
 
238
253
  def test_for_fd
239
- buf = ""
254
+ buf = "".dup
240
255
  @mq = POSIX_MQ.new @path, IO::CREAT|IO::RDWR, 0666
241
256
  @alt = POSIX_MQ.for_fd(@mq.to_io.to_i)
242
257
  assert_equal true, @mq.send("hello", 0)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posix_mq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruby POSIX MQ hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-16 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: olddoc
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.4.5
93
+ rubygems_version: 2.5.2
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: POSIX Message Queues for Ruby