posix_mq 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,5 +1,50 @@
1
1
  ChangeLog from http://bogomips.org/ruby_posix_mq.git
2
2
 
3
+ commit b14ae708a9e53b1f8a274aa78a610b2f776847f5
4
+ Author: Eric Wong <normalperson@yhbt.net>
5
+ Date: Sat Feb 15 13:34:12 2014 +0000
6
+
7
+ posix_mq 2.1.0 - ensure compatibility with future Rubies
8
+
9
+ * avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1
10
+ * prepare for rb_thread_blocking_region removal
11
+
12
+ commit b77f930e712812024c3d379395c2879b312336f8
13
+ Author: Eric Wong <normalperson@yhbt.net>
14
+ Date: Sat Feb 15 13:13:06 2014 +0000
15
+
16
+ avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1
17
+
18
+ This will be removed in Ruby 2.2, so avoid the deprecation warning.
19
+
20
+ commit a2a00d4ba8d16838e613cbecfad98cb188929e14
21
+ Author: Eric Wong <normalperson@yhbt.net>
22
+ Date: Sun Feb 9 00:40:11 2014 +0000
23
+
24
+ prepare for rb_thread_blocking_region removal
25
+
26
+ It'll be OK to use rb_thread_call_without_gvl when
27
+ rb_thread_blocking_region is not detectable at all.
28
+ We still use rb_thread_blocking_region for Ruby 2.0-2.1 because
29
+ rb_thread_call_without_gvl was detectable in 1.9.3, but not
30
+ usable as an internal symbol.
31
+
32
+ ref: https://bugs.ruby-lang.org/issues/9502
33
+
34
+ commit 5f620f4435afcdc2304f53c74ff8b65fc4f04b0d
35
+ Author: Eric Wong <normalperson@yhbt.net>
36
+ Date: Mon Sep 30 18:24:33 2013 +0000
37
+
38
+ Rakefile: kill raa_update task
39
+
40
+ RAA is dead.
41
+
42
+ commit 0e9e6c54bb25eadcf955a7abb0b60e97388d8290
43
+ Author: Eric Wong <normalperson@yhbt.net>
44
+ Date: Mon Aug 6 21:06:38 2012 +0000
45
+
46
+ pkg.mk: update
47
+
3
48
  commit 86f36a2d88aca8fdef45fd2a757f98a593935ba9
4
49
  Author: Eric Wong <normalperson@yhbt.net>
5
50
  Date: Mon Aug 6 20:58:04 2012 +0000
data/GIT-VERSION-FILE CHANGED
@@ -1 +1 @@
1
- GIT_VERSION = 2.0.0
1
+ GIT_VERSION = 2.1.0
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.0.0.GIT
4
+ DEF_VER=v2.1.0
5
5
 
6
6
  LF='
7
7
  '
data/GNUmakefile CHANGED
@@ -8,7 +8,6 @@ doc:: man-rdoc
8
8
  include pkg.mk
9
9
  ifneq ($(VERSION),)
10
10
  release::
11
- $(RAKE) raa_update VERSION=$(VERSION)
12
11
  $(RAKE) publish_news VERSION=$(VERSION)
13
12
  endif
14
13
 
data/LATEST CHANGED
@@ -1,8 +1,5 @@
1
- === posix_mq 2.0.0 - a minor API change + FreeBSD fixes / 2012-08-06 21:02 UTC
1
+ === posix_mq 2.1.0 - ensure compatibility with future Rubies / 2014-02-15 13:35 UTC
2
2
 
3
- Blocking methods no longer raise Errno::EINTR (to match
4
- Ruby IO semantics, making code easier to work with).
5
-
6
- There are also many FreeBSD-related fixes thanks to
7
- Hleb Valoshka <375gnu@gmail.com> and small code cleanups.
3
+ * avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1
4
+ * prepare for rb_thread_blocking_region removal
8
5
 
data/NEWS CHANGED
@@ -1,3 +1,8 @@
1
+ === posix_mq 2.1.0 - ensure compatibility with future Rubies / 2014-02-15 13:35 UTC
2
+
3
+ * avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1
4
+ * prepare for rb_thread_blocking_region removal
5
+
1
6
  === posix_mq 2.0.0 - a minor API change + FreeBSD fixes / 2012-08-06 21:02 UTC
2
7
 
3
8
  Blocking methods no longer raise Errno::EINTR (to match
data/Rakefile CHANGED
@@ -31,41 +31,3 @@ task :publish_news do
31
31
  rf.login
32
32
  rf.post_news('qrp', subject, body)
33
33
  end
34
-
35
- desc "post to RAA"
36
- task :raa_update do
37
- require 'rubygems'
38
- require 'net/http'
39
- require 'net/netrc'
40
- rc = Net::Netrc.locate('posix_mq-raa') or abort "~/.netrc not found"
41
- password = rc.password
42
-
43
- s = Gem::Specification.load('posix_mq.gemspec')
44
- desc = [ s.description.strip ]
45
- desc << ""
46
- desc << "* #{s.email}"
47
- desc << "* #{git_url}"
48
- desc << "* #{cgit_url}"
49
- desc = desc.join("\n")
50
- uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
51
- form = {
52
- :name => s.name,
53
- :short_description => s.summary,
54
- :version => s.version.to_s,
55
- :status => 'experimental',
56
- :owner => s.authors.first,
57
- :email => s.email,
58
- :category_major => 'Library',
59
- :category_minor => 'System',
60
- :url => s.homepage,
61
- :download => 'http://rubyforge.org/frs/?group_id=5626',
62
- :license => 'LGPL', # LGPLv3, actually, but RAA is ancient...
63
- :description_style => 'Plain',
64
- :description => desc,
65
- :pass => password,
66
- :submit => 'Update',
67
- }
68
- res = Net::HTTP.post_form(uri, form)
69
- p res
70
- puts res.body
71
- end
@@ -6,6 +6,7 @@ have_header("mqueue.h") or abort "mqueue.h header missing"
6
6
  have_header("pthread.h")
7
7
  have_func("rb_str_set_len")
8
8
  have_func('rb_thread_blocking_region')
9
+ have_func('rb_thread_call_without_gvl')
9
10
  have_library("m")
10
11
  have_library("rt")
11
12
  have_library("pthread")
@@ -95,18 +95,26 @@ static void rb_18_str_set_len(VALUE str, long len)
95
95
  #define rb_str_set_len rb_18_str_set_len
96
96
  #endif /* !defined(HAVE_RB_STR_SET_LEN) */
97
97
 
98
+ #if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && defined(HAVE_RUBY_THREAD_H)
99
+ /* Ruby 2.0+ */
100
+ # include <ruby/thread.h>
101
+ # define WITHOUT_GVL(fn,a,ubf,b) \
102
+ rb_thread_call_without_gvl((fn),(a),(ubf),(b))
103
+ #elif defined(HAVE_RB_THREAD_BLOCKING_REGION)
104
+ typedef VALUE (*my_blocking_fn_t)(void*);
105
+ # define WITHOUT_GVL(fn,a,ubf,b) \
106
+ rb_thread_blocking_region((my_blocking_fn_t)(fn),(a),(ubf),(b))
107
+
108
+ #else /* Ruby 1.8 */
98
109
  /* partial emulation of the 1.9 rb_thread_blocking_region under 1.8 */
99
- #ifndef HAVE_RB_THREAD_BLOCKING_REGION
100
110
  # include <rubysig.h>
101
111
  # define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
102
112
  typedef void rb_unblock_function_t(void *);
103
- typedef VALUE rb_blocking_function_t(void *);
104
- static VALUE
105
- rb_thread_blocking_region(
106
- rb_blocking_function_t *func, void *data1,
107
- rb_unblock_function_t *ubf, void *data2)
113
+ typedef void * rb_blocking_function_t(void *);
114
+ static void * WITHOUT_GVL(rb_blocking_function_t *func, void *data1,
115
+ rb_unblock_function_t *ubf, void *data2)
108
116
  {
109
- VALUE rv;
117
+ void *rv;
110
118
 
111
119
  assert(RUBY_UBF_IO == ubf && "RUBY_UBF_IO required for emulation");
112
120
 
@@ -120,6 +128,7 @@ rb_thread_blocking_region(
120
128
 
121
129
  /* used to pass arguments to mq_open inside blocking region */
122
130
  struct open_args {
131
+ mqd_t des;
123
132
  int argc;
124
133
  const char *name;
125
134
  int oflags;
@@ -130,6 +139,10 @@ struct open_args {
130
139
  /* used to pass arguments to mq_send/mq_receive inside blocking region */
131
140
  struct rw_args {
132
141
  mqd_t des;
142
+ union {
143
+ ssize_t received;
144
+ int retval;
145
+ };
133
146
  char *msg_ptr;
134
147
  size_t msg_len;
135
148
  unsigned msg_prio;
@@ -229,43 +242,44 @@ static struct timespec *convert_timeout(struct timespec *dest, VALUE t)
229
242
  }
230
243
 
231
244
  /* (may) run without GVL */
232
- static VALUE xopen(void *ptr)
245
+ static void * xopen(void *ptr)
233
246
  {
234
247
  struct open_args *x = ptr;
235
- mqd_t rv;
236
248
 
237
249
  switch (x->argc) {
238
- case 2: rv = mq_open(x->name, x->oflags); break;
239
- case 3: rv = mq_open(x->name, x->oflags, x->mode, NULL); break;
240
- case 4: rv = mq_open(x->name, x->oflags, x->mode, &x->attr); break;
241
- default: rv = MQD_INVALID;
250
+ case 2: x->des = mq_open(x->name, x->oflags); break;
251
+ case 3: x->des = mq_open(x->name, x->oflags, x->mode, NULL); break;
252
+ case 4: x->des = mq_open(x->name, x->oflags, x->mode, &x->attr); break;
253
+ default: x->des = MQD_INVALID;
242
254
  }
243
255
 
244
- return (VALUE)rv;
256
+ return NULL;
245
257
  }
246
258
 
247
259
  /* runs without GVL */
248
- static VALUE xsend(void *ptr)
260
+ static void *xsend(void *ptr)
249
261
  {
250
262
  struct rw_args *x = ptr;
251
263
 
252
- if (x->timeout)
253
- return (VALUE)mq_timedsend(x->des, x->msg_ptr, x->msg_len,
254
- x->msg_prio, x->timeout);
264
+ x->retval = x->timeout ?
265
+ mq_timedsend(x->des, x->msg_ptr, x->msg_len,
266
+ x->msg_prio, x->timeout) :
267
+ mq_send(x->des, x->msg_ptr, x->msg_len, x->msg_prio);
255
268
 
256
- return (VALUE)mq_send(x->des, x->msg_ptr, x->msg_len, x->msg_prio);
269
+ return NULL;
257
270
  }
258
271
 
259
272
  /* runs without GVL */
260
- static VALUE xrecv(void *ptr)
273
+ static void * xrecv(void *ptr)
261
274
  {
262
275
  struct rw_args *x = ptr;
263
276
 
264
- if (x->timeout)
265
- return (VALUE)mq_timedreceive(x->des, x->msg_ptr, x->msg_len,
266
- &x->msg_prio, x->timeout);
277
+ x->received = x->timeout ?
278
+ mq_timedreceive(x->des, x->msg_ptr, x->msg_len,
279
+ &x->msg_prio, x->timeout) :
280
+ mq_receive(x->des, x->msg_ptr, x->msg_len, &x->msg_prio);
267
281
 
268
- return (VALUE)mq_receive(x->des, x->msg_ptr, x->msg_len, &x->msg_prio);
282
+ return NULL;
269
283
  }
270
284
 
271
285
  /* called by GC */
@@ -438,7 +452,8 @@ static VALUE init(int argc, VALUE *argv, VALUE self)
438
452
  check_struct_type(attr);
439
453
  }
440
454
 
441
- mq->des = (mqd_t)xopen(&x);
455
+ (void)xopen(&x);
456
+ mq->des = x.des;
442
457
  if (mq->des == MQD_INVALID) {
443
458
  switch (errno) {
444
459
  case ENOMEM:
@@ -446,7 +461,8 @@ static VALUE init(int argc, VALUE *argv, VALUE self)
446
461
  case ENFILE:
447
462
  case ENOSPC:
448
463
  rb_gc();
449
- mq->des = (mqd_t)xopen(&x);
464
+ (void)xopen(&x);
465
+ mq->des = x.des;
450
466
  }
451
467
  if (mq->des == MQD_INVALID)
452
468
  rb_sys_fail("mq_open");
@@ -532,7 +548,6 @@ static VALUE _send(int sflags, int argc, VALUE *argv, VALUE self)
532
548
  struct posix_mq *mq = get(self, 1);
533
549
  struct rw_args x;
534
550
  VALUE buffer, prio, timeout;
535
- int rv;
536
551
  struct timespec expire;
537
552
 
538
553
  rb_scan_args(argc, argv, "12", &buffer, &prio, &timeout);
@@ -543,8 +558,8 @@ static VALUE _send(int sflags, int argc, VALUE *argv, VALUE self)
543
558
  x.msg_prio = NIL_P(prio) ? 0 : NUM2UINT(prio);
544
559
 
545
560
  retry:
546
- rv = (int)rb_thread_blocking_region(xsend, &x, RUBY_UBF_IO, 0);
547
- if (rv == -1) {
561
+ WITHOUT_GVL(xsend, &x, RUBY_UBF_IO, 0);
562
+ if (x.retval == -1) {
548
563
  if (errno == EINTR)
549
564
  goto retry;
550
565
  if (errno == EAGAIN && (sflags & PMQ_TRY))
@@ -570,7 +585,6 @@ static VALUE send0(VALUE self, VALUE buffer)
570
585
  {
571
586
  struct posix_mq *mq = get(self, 1);
572
587
  struct rw_args x;
573
- int rv;
574
588
 
575
589
  setup_send_buffer(&x, buffer);
576
590
  x.des = mq->des;
@@ -578,8 +592,8 @@ static VALUE send0(VALUE self, VALUE buffer)
578
592
  x.msg_prio = 0;
579
593
 
580
594
  retry:
581
- rv = (int)rb_thread_blocking_region(xsend, &x, RUBY_UBF_IO, 0);
582
- if (rv == -1) {
595
+ WITHOUT_GVL(xsend, &x, RUBY_UBF_IO, 0);
596
+ if (x.retval == -1) {
583
597
  if (errno == EINTR)
584
598
  goto retry;
585
599
  rb_sys_fail("mq_send");
@@ -662,7 +676,6 @@ static VALUE _receive(int rflags, int argc, VALUE *argv, VALUE self)
662
676
  struct posix_mq *mq = get(self, 1);
663
677
  struct rw_args x;
664
678
  VALUE buffer, timeout;
665
- ssize_t r;
666
679
  struct timespec expire;
667
680
 
668
681
  if (mq->attr.mq_msgsize < 0) {
@@ -686,8 +699,8 @@ static VALUE _receive(int rflags, int argc, VALUE *argv, VALUE self)
686
699
  x.des = mq->des;
687
700
 
688
701
  retry:
689
- r = (ssize_t)rb_thread_blocking_region(xrecv, &x, RUBY_UBF_IO, 0);
690
- if (r < 0) {
702
+ WITHOUT_GVL(xrecv, &x, RUBY_UBF_IO, 0);
703
+ if (x.received < 0) {
691
704
  if (errno == EINTR)
692
705
  goto retry;
693
706
  if (errno == EAGAIN && (rflags & PMQ_TRY))
@@ -695,7 +708,7 @@ retry:
695
708
  rb_sys_fail("mq_receive");
696
709
  }
697
710
 
698
- rb_str_set_len(buffer, r);
711
+ rb_str_set_len(buffer, x.received);
699
712
 
700
713
  if (rflags & PMQ_WANTARRAY)
701
714
  return rb_ary_new3(2, buffer, UINT2NUM(x.msg_prio));
data/pkg.mk CHANGED
@@ -69,7 +69,7 @@ doc:: .document .wrongdoc.yml $(pkg_extra)
69
69
  $(RM) -r doc
70
70
  $(WRONGDOC) all
71
71
  install -m644 COPYING doc/COPYING
72
- install -m644 $(shell grep '^[A-Z]' .document) doc/
72
+ install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
73
73
 
74
74
  ifneq ($(VERSION),)
75
75
  pkggem := pkg/$(rfpackage)-$(VERSION).gem
@@ -167,5 +167,9 @@ doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
167
167
  doc_gz:
168
168
  for i in $(docs); do \
169
169
  gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
170
+ check-warnings:
171
+ @(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
172
+ do $(RUBY) -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
170
173
 
171
174
  .PHONY: all .FORCE-GIT-VERSION-FILE doc test $(test_units) manifest
175
+ .PHONY: check-warnings
metadata CHANGED
@@ -1,47 +1,54 @@
1
- --- !ruby/object:Gem::Specification
2
- name: posix_mq
3
- version: !ruby/object:Gem::Version
4
- hash: 15
1
+ --- !ruby/object:Gem::Specification
2
+ name: !binary |-
3
+ cG9zaXhfbXE=
4
+ version: !ruby/object:Gem::Version
5
+ version: 2.1.0
5
6
  prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 0
10
- version: 2.0.0
11
7
  platform: ruby
12
- authors:
13
- - Ruby POSIX MQ hackers
8
+ authors:
9
+ - !binary |-
10
+ UnVieSBQT1NJWCBNUSBoYWNrZXJz
14
11
  autorequire:
15
12
  bindir: bin
16
13
  cert_chain: []
17
-
18
- date: 2012-08-06 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: wrongdoc
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
14
+ date: 2014-02-15 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: !binary |-
18
+ d3Jvbmdkb2M=
19
+ requirement: !ruby/object:Gem::Requirement
24
20
  none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 5
29
- segments:
30
- - 1
31
- - 5
32
- version: "1.5"
21
+ requirements:
22
+ - - !binary |-
23
+ fj4=
24
+ - !ruby/object:Gem::Version
25
+ version: !binary |-
26
+ MS41
33
27
  type: :development
34
- version_requirements: *id001
35
- description: |-
36
- POSIX message queues allow local processes to exchange data in the form
28
+ prerelease: false
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - !binary |-
33
+ fj4=
34
+ - !ruby/object:Gem::Version
35
+ version: !binary |-
36
+ MS41
37
+ description: ! 'POSIX message queues allow local processes to exchange data in the
38
+ form
39
+
37
40
  of messages. This API is distinct from that provided by System V
38
- message queues, but provides similar functionality.
39
- email: ruby.posix.mq@librelist.com
40
- executables:
41
- - posix-mq-rb
42
- extensions:
43
- - ext/posix_mq/extconf.rb
44
- extra_rdoc_files:
41
+
42
+ message queues, but provides similar functionality.'
43
+ email: !binary |-
44
+ cnVieS5wb3NpeC5tcUBsaWJyZWxpc3QuY29t
45
+ executables:
46
+ - !binary |-
47
+ cG9zaXgtbXEtcmI=
48
+ extensions:
49
+ - !binary |-
50
+ ZXh0L3Bvc2l4X21xL2V4dGNvbmYucmI=
51
+ extra_rdoc_files:
45
52
  - README
46
53
  - LICENSE
47
54
  - NEWS
@@ -49,7 +56,7 @@ extra_rdoc_files:
49
56
  - lib/posix_mq.rb
50
57
  - ext/posix_mq/posix_mq.c
51
58
  - LATEST
52
- files:
59
+ files:
53
60
  - .document
54
61
  - .gitignore
55
62
  - .manifest
@@ -79,39 +86,32 @@ files:
79
86
  - test/test_posix_mq.rb
80
87
  homepage: http://bogomips.org/ruby_posix_mq/
81
88
  licenses: []
82
-
83
89
  post_install_message:
84
- rdoc_options:
90
+ rdoc_options:
85
91
  - -t
86
92
  - posix_mq - POSIX Message Queues for Ruby
87
93
  - -W
88
94
  - http://bogomips.org/ruby_posix_mq.git/tree/%s
89
- require_paths:
95
+ require_paths:
90
96
  - lib
91
- required_ruby_version: !ruby/object:Gem::Requirement
97
+ required_ruby_version: !ruby/object:Gem::Requirement
92
98
  none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
104
  none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
109
  requirements: []
110
-
111
- rubyforge_project: qrp
112
- rubygems_version: 1.8.24
110
+ rubyforge_project: !binary |-
111
+ cXJw
112
+ rubygems_version: 1.8.23
113
113
  signing_key:
114
114
  specification_version: 3
115
115
  summary: POSIX Message Queues for Ruby
116
- test_files:
116
+ test_files:
117
117
  - test/test_posix_mq.rb