posix_mq 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -4,4 +4,4 @@ NEWS
4
4
  ChangeLog
5
5
  lib
6
6
  ext/posix_mq/posix_mq.c
7
- posix-mq.rb.1
7
+ posix-mq-rb_1
data/.manifest CHANGED
@@ -5,7 +5,7 @@ COPYING
5
5
  ChangeLog
6
6
  Documentation/.gitignore
7
7
  Documentation/GNUmakefile
8
- Documentation/posix-mq.rb.1.txt
8
+ Documentation/posix-mq-rb.1.txt
9
9
  GIT-VERSION-FILE
10
10
  GIT-VERSION-GEN
11
11
  GNUmakefile
@@ -13,12 +13,12 @@ LICENSE
13
13
  NEWS
14
14
  README
15
15
  Rakefile
16
- bin/posix-mq.rb
16
+ bin/posix-mq-rb
17
17
  ext/posix_mq/extconf.rb
18
18
  ext/posix_mq/posix_mq.c
19
19
  lib/posix_mq.rb
20
20
  local.mk.sample
21
- man/man1/posix-mq.rb.1
21
+ man/man1/posix-mq-rb.1
22
22
  posix_mq.gemspec
23
23
  setup.rb
24
24
  test/test_posix_mq.rb
data/ChangeLog CHANGED
@@ -1,339 +1,55 @@
1
- ChangeLog from git://git.bogomips.org/ruby_posix_mq.git ()
1
+ ChangeLog from git://git.bogomips.org/ruby_posix_mq.git (v0.4.0..v0.5.0)
2
2
 
3
- commit aa9beecf64739ea084158ff63a92f626bfb5717d
3
+ commit f3605c820fd73713e34950170bf759e1af204038
4
4
  Author: Eric Wong <normalperson@yhbt.net>
5
- Date: Sat Mar 13 00:28:14 2010 -0800
5
+ Date: Tue May 4 19:48:18 2010 -0700
6
6
 
7
- posix_mq 0.4.0
7
+ posix_mq 0.5.0
8
8
 
9
- Small bugfixes and small API changes to avoid potential
10
- issues/misuse are the focus of this release.
9
+ Uncommonly raised exceptions due to programmer error are now
10
+ raised more safely with respect to the MRI garbage collector.
11
11
 
12
- For non-blocking operation, the GVL is no longer bounced. This
13
- reduces synchronization/scheduling overhead when used in
14
- non-blocking applications.
12
+ The "posix-mq.rb" executable has been renamed to "posix-mq-rb"
13
+ to respect RPS and is also hopefully easier to type/read when
14
+ used in scripts. I'm preserving the "rb" in the name since I
15
+ hope to have a more portable, C-only version someday.
15
16
 
16
- Small cleanups and documentation improvements, too.
17
-
18
- * make POSIX_MQ#dup and POSIX_MQ#clone no-op
19
- * do not release GVL for non-blocking operations
20
- * do not release GVL when unlinking/opening
21
- * POSIX_MQ#<< does not release GVL when non-blocking
22
- * avoid shadow warnings
23
- * README: add mailing list archives info
24
- * POSIX_MQ#to_io works under FreeBSD, too
25
- * fix potential race with notify(&block)
26
- * add TODO item for using netlink under Linux
27
- * remove non-portable #warning CPP directive
28
- * ensure POSIX_MQ#name is clobber-proof
29
-
30
- commit 437cbe78cb0f239e34f9dbf1341f5b85f96f2f25
31
- Author: Eric Wong <normalperson@yhbt.net>
32
- Date: Sat Mar 13 00:22:22 2010 -0800
33
-
34
- ensure POSIX_MQ#name is clobber-proof
35
-
36
- We don't want folks to accidentally clobber the value for
37
- others, so allocate a new string object for it (don't worry,
38
- rb_str_dup() is cheap in 1.9).
39
-
40
- commit 74e1f75b238416d9ac402f291431a5e457ae313f
41
- Author: Eric Wong <normalperson@yhbt.net>
42
- Date: Sat Mar 13 00:08:37 2010 -0800
43
-
44
- remove non-portable #warning CPP directive
45
-
46
- There's a good chance they're not using GCC if they're on some
47
- weird platform that we'd emit a warning for.
48
-
49
- commit 9881f136858ac8f3a77a6cea8ce15b1cdb4ad55a
50
- Author: Eric Wong <normalperson@yhbt.net>
51
- Date: Tue Mar 2 22:47:29 2010 -0800
52
-
53
- add TODO item for using netlink under Linux
54
-
55
- commit 19668b0edc9b09cfd72247f7041390e0328032a0
56
- Author: Eric Wong <normalperson@yhbt.net>
57
- Date: Tue Mar 2 21:20:28 2010 -0800
58
-
59
- fix potential race with notify(&block)
60
-
61
- We need to assign the notify_thread before assigning the
62
- notification. Otherwise, there's a chance the notification
63
- could fire and the notify_thread is not properly assigned for
64
- the POSIX_MQ object when the pipe becomes readable.
65
-
66
- commit 0f4a8ef81479f9eff9037011d81b96cf402cbe7b
67
- Author: Eric Wong <normalperson@yhbt.net>
68
- Date: Sat Feb 20 17:36:16 2010 -0800
69
-
70
- POSIX_MQ#to_io works under FreeBSD, too
71
-
72
- commit 44cd880c96a76d43f6dcc7f7cdf7f687e32bda0c
73
- Author: Eric Wong <normalperson@yhbt.net>
74
- Date: Sat Feb 20 17:35:08 2010 -0800
75
-
76
- README: add mailing list archives info
77
-
78
- commit 4b56e475483454cd6616dd3c310c251940e9368b
79
- Author: Eric Wong <normalperson@yhbt.net>
80
- Date: Sat Feb 20 17:19:52 2010 -0800
81
-
82
- avoid shadow warnings
83
-
84
- commit 97ef1cfd699640e40d2d63746d005f4f4cf6a863
85
- Author: Eric Wong <normalperson@yhbt.net>
86
- Date: Sat Feb 20 14:52:16 2010 -0800
87
-
88
- POSIX_MQ#<< does not release GVL when non-blocking
89
-
90
- Missed this with the other change
91
-
92
- commit 5849a3ca8e0691a7f39c5cdbfc09fc34ee4da308
93
- Author: Eric Wong <normalperson@yhbt.net>
94
- Date: Sat Feb 20 14:46:04 2010 -0800
95
-
96
- do not release GVL when unlinking/opening
97
-
98
- Since the message queue is not actually on a (slow) block
99
- device, it's unlikely to block in a way where other tasks may be
100
- scheduled by the kernel. So avoid complicating things and
101
- unnecessary task switching and assume mq_open/mq_unlink can
102
- be executed as fast as the CPU/memory subsystems allows.
103
-
104
- commit a90d0f97c9eb5d9683af09b60ef7af9e94a255c3
105
- Author: Eric Wong <normalperson@yhbt.net>
106
- Date: Sat Feb 20 14:40:16 2010 -0800
107
-
108
- do not release GVL for non-blocking operations
109
-
110
- There's no point in wasting cycles releasing and reacquiring
111
- a lock when we know we won't block. Since most non-blocking
112
- users are expected to be single/few-threaded processes, this
113
- will likely help them.
114
-
115
- commit 67a59023164bc039129b34a742f06ba376687684
116
- Author: Eric Wong <normalperson@yhbt.net>
117
- Date: Wed Feb 17 00:37:43 2010 -0800
118
-
119
- make POSIX_MQ#dup and POSIX_MQ#clone no-op
120
-
121
- It'll cause problems for the automatic mq_close() during GC
122
- otherwise, as dup(2) on an mqd_t isn't portable.
123
-
124
- Of course there's no point in cloning or duping, either, as
125
- mq_send/mq_receive operations are always atomic at the kernel
126
- level and only one thread can have a notification registered
127
- for it.
128
-
129
- commit 05e577616b74bea99a0e43e07f28823ddda1aaf9
130
- Author: Eric Wong <normalperson@yhbt.net>
131
- Date: Sat Feb 13 03:39:17 2010 -0800
132
-
133
- posix_mq 0.3.1
134
-
135
- This fixes a misuse of the Ruby API leading to memory leaks in
136
- cases where message queues are continually opened and closed
137
- throughout the lifetime of the application.
138
-
139
- Fortunately applications have little reason to repeatedly open
140
- and close message queue descriptors: they are
141
- multi-thread/multi-process-safe in every way imaginable and also
142
- capable of non-blocking operation.
143
-
144
- commit 9adbee0ab71bf408db5c3befb43b2bab0d86ebb2
145
- Author: Eric Wong <normalperson@yhbt.net>
146
- Date: Sat Feb 13 03:30:44 2010 -0800
147
-
148
- use GC correctly and avoid memory leaks
149
-
150
- We still need to explicitly free the pointer we're given, and
151
- not just close the associated file descriptor. Fortunately most
152
- people to not spend all day opening/closing message queue
153
- descriptors so this leak may not be noticeable.
154
-
155
- commit c07cf2979036b9550566d59d6d4899be98f3e553
156
- Author: Eric Wong <normalperson@yhbt.net>
157
- Date: Thu Jan 21 20:44:22 2010 -0800
158
-
159
- add #shift test with destination buffer
17
+ Minor cleanups and documentation now uses RDoc 2.5.x
160
18
 
161
- commit 1d0bf6f1d39e085948008c2c6d381ed929ac109e
19
+ commit f4d7d9d14cf65595aa3d98429a6732bd6b007b4a
162
20
  Author: Eric Wong <normalperson@yhbt.net>
163
- Date: Sat Jan 9 15:16:40 2010 -0800
21
+ Date: Tue May 4 19:37:37 2010 -0700
164
22
 
165
- Rakefile: fix raa_update task
23
+ doc: updates for RDoc 2.5.x
166
24
 
167
- commit 2e420820d3b3fb228c810937539f95a618a2c271
25
+ commit 7b1b8a1cbbedc2764d4a8ab0d992f9f2ef73d9b7
168
26
  Author: Eric Wong <normalperson@yhbt.net>
169
- Date: Sat Jan 9 22:52:27 2010 +0000
27
+ Date: Tue May 4 19:31:47 2010 -0700
170
28
 
171
- posix_mq 0.3.0
29
+ rename `posix-mq.rb' executable to `posix-mq-rb'
172
30
 
173
- This release adds a few new API methods, fixes MRI 1.8.6
174
- support. We should now have full feature parity with
175
- underlying POSIX message queue C API.
31
+ ".rb" in the executable name is discouraged by the
32
+ {Ruby packaging standard}[http://github.com/chneukirchen/rps]
33
+ and probably confusing.
176
34
 
177
- * POSIX_MQ#notify(&block)
178
- RDoc: http://bogomips.org/ruby_posix_mq/POSIX_MQ.html#M000001
179
- This is only supported on platforms that implement
180
- SIGEV_THREAD with mq_notify(3) (tested with glibc + Linux).
181
- Other platforms will have to continue to rely on signal
182
- notifications via POSIX#notify=signal, or IO notifications
183
- in FreeBSD (and Linux).
184
-
185
- * POSIX_MQ#shift([buffer [,timeout]])
186
- Shorthand for the common "POSIX_MQ#receive.first"
187
- when you do not care for priority of the received message.
188
-
189
- Rev, EventMachine and Reactor support are planned for
190
- Linux, FreeBSD and possibly any other platforms where POSIX
191
- message queues are implemented with a file descriptor.
192
-
193
- commit 2c71257b2b95e737088726ffc963b4e72f1b5455
194
- Author: Eric Wong <normalperson@yhbt.net>
195
- Date: Sat Jan 9 22:49:49 2010 +0000
196
-
197
- MRI 1.8 does not have rb_str_flush
198
-
199
- It's Rubinius-specific and we use rb_str_resize
200
- there anyways...
201
-
202
- commit 531106e51e519458d37bed3721da4eff2f163206
203
- Author: Eric Wong <normalperson@yhbt.net>
204
- Date: Fri Jan 8 11:30:49 2010 -0800
205
-
206
- no point in non-blocking for fd notifications
207
-
208
- It's not needed since the native thread will retry in the
209
- unlikely case of EINTR/EAGAIN. And writing one byte to a pipe
210
- that's guaranteed by POSIX to be at least 512 bytes is highly
211
- unlikely.
212
-
213
- It's also bad because F_SETFL takes the big kernel lock under
214
- Linux (and possibly other systems), and doing it unnecessarily
215
- is a waste of system cycles.
216
-
217
- commit d03c76ae11ca6294e05262df747e4d43822ada73
218
- Author: Eric Wong <normalperson@yhbt.net>
219
- Date: Fri Jan 8 11:25:06 2010 -0800
220
-
221
- mode_t is usually unsigned
222
-
223
- Most used open modes are well under INT_MAX, however
224
-
225
- commit b3c31cf444e2ca3dae0f6d2370944bfbf3382d88
226
- Author: Eric Wong <normalperson@yhbt.net>
227
- Date: Thu Jan 7 01:45:25 2010 -0800
228
-
229
- add POSIX_MQ#shift helper method
230
-
231
- This acts like POSIX_MQ#receive but only returns the message
232
- without the priority.
233
-
234
- commit 3700db51399e4949ed314ad0545d037b7762064e
235
- Author: Eric Wong <normalperson@yhbt.net>
236
- Date: Thu Jan 7 09:28:57 2010 +0000
237
-
238
- POSIX_MQ#notify only works on GNU/Linux for now
239
-
240
- SIGEV_THREAD is not easy to implement, so many platforms
241
- do not implement it.
242
-
243
- commit 40d61f55ac53e3cd2f229d0b032da03032e3d53d
244
- Author: Eric Wong <normalperson@yhbt.net>
245
- Date: Thu Jan 7 00:37:57 2010 -0800
246
-
247
- POSIX_MQ#notify block execution on message received
248
-
249
- This is implementation uses both a short-lived POSIX thread and
250
- a pre-spawned Ruby Thread in a manner that works properly under
251
- both Ruby 1.8 (green threads) and 1.9 (where Ruby Threads are
252
- POSIX threads).
253
-
254
- The short-lived POSIX thread will write a single "\0" byte to
255
- a pipe the Ruby Thread waits on. This operation is atomic
256
- on all platforms. Once the Ruby Thread is woken up from the
257
- pipe, it will execute th block given to it.
258
-
259
- This dual-thread implementation is inspired by the way glibc
260
- implements mq_notify(3) + SIGEV_THREAD under Linux where the
261
- kernel itself cannot directly spawn POSIX threads.
262
-
263
- commit d8c8fb4155c1feea454abc3ed3f0a4b26e90be68
264
- Author: Eric Wong <normalperson@yhbt.net>
265
- Date: Sun Jan 3 05:26:00 2010 +0000
266
-
267
- fix warnings on platforms where mqd_t != int
268
-
269
- The POSIX manpages specify the return values of all
270
- mq_* functions besides mq_open(3) to be "int", not "mqd_t".
271
-
272
- commit dbe5ed46e07b853e79e44141924a0166016e3e44
273
- Author: Eric Wong <normalperson@yhbt.net>
274
- Date: Sat Jan 2 23:19:34 2010 -0800
275
-
276
- bump GIT-VERSION-GEN
277
-
278
- Shouldn't affect most people since they should just
279
- take code from git...
35
+ If I ever get around to it, a non-Ruby version of this
36
+ executable is planned, and that will be called "posix-mq"
280
37
 
281
- commit fd2fcdeee6b44f7854255cb7e01c81db3cd2d99c
38
+ commit 33368c839dc8c63489591bda6e60c78025be8852
282
39
  Author: Eric Wong <normalperson@yhbt.net>
283
- Date: Sun Jan 3 05:46:45 2010 +0000
40
+ Date: Thu Apr 22 00:02:25 2010 -0700
284
41
 
285
- posix_mq 0.2.0
286
-
287
- This release fixes notification (un)registration and should be
288
- fully-supported on modern FreeBSD (7.2+) releases.
42
+ GC safety fixes
289
43
 
290
- POSIX_MQ#notify=nil correctly unregister notification requests.
291
- POSIX_MQ#notify=false now provids the no-op SIGEV_NONE
292
- functionality. Under FreeBSD, using IO.select on POSIX_MQ
293
- objects is now possible as it has always been under Linux.
44
+ Avoid the RSTRING_PTR(rb_inspect(val)) construct, as it may not
45
+ preserve the value of rb_inspect() on the stack.
294
46
 
295
- commit 350bfc831938d84cc2d478f2cf88583863cb64fb
47
+ commit a9a365326ea0f7a37852d25adfb03049c0b24c22
296
48
  Author: Eric Wong <normalperson@yhbt.net>
297
- Date: Sun Jan 3 05:35:50 2010 +0000
49
+ Date: Wed Apr 21 23:58:25 2010 -0700
298
50
 
299
- support POSIX_MQ#to_io under FreeBSD
51
+ cleaner lookup "Signal" of constant
300
52
 
301
- FreeBSD implements an __mq_oshandle(mqd_t mqd) function
302
- to convert mqd_t to integer file descriptors.
303
-
304
- commit 26015d39e9c848a536b4ea44802f858a4e6e74f7
305
- Author: Eric Wong <normalperson@yhbt.net>
306
- Date: Sun Jan 3 04:17:56 2010 +0000
307
-
308
- fix build under FreeBSD 7.2
309
-
310
- FreeBSD seems to need some files explicitly included.
311
-
312
- commit e7ac70686b3c09953f6c41966dbd77f77368a9ec
313
- Author: Eric Wong <normalperson@yhbt.net>
314
- Date: Sat Jan 2 21:19:58 2010 -0800
315
-
316
- doc: FreeBSD-specific notes + example code
317
-
318
- commit 6f24b5626f89fbb6445c0943ba71f56c8945e18f
319
- Author: Eric Wong <normalperson@yhbt.net>
320
- Date: Sat Jan 2 20:41:39 2010 -0800
321
-
322
- Fix mq.notify = nil to unregister notifications
323
-
324
- "mq.notify = false" also works now, doing what
325
- "mq.notify = nil" used to do (using SIGEV_NONE).
326
-
327
- I was confused by SIGEV_NONE usage vs using a NULL pointer for
328
- the notification passed mq_notify(3). SIGEV_NONE does not
329
- actually unregister, it registers a no-op notification which
330
- prevents other processes from taking us.
331
-
332
- This also fixes the test case to pass under both Linux and
333
- FreeBSD.
334
-
335
- commit 522d4d1472c216bd95a16ca5b118bc14693aad64
336
- Author: Eric Wong <normalperson@yhbt.net>
337
- Date: Sat Jan 2 02:33:23 2010 -0800
338
-
339
- initial commit
53
+ Instead of blindly defining a module, this is more flexible in
54
+ case Signal in Ruby itself becomes something other than a
55
+ module.
@@ -5,7 +5,7 @@ PANDOC_OPTS = -f markdown --email-obfuscation=none --sanitize-html
5
5
  pandoc = $(PANDOC) $(PANDOC_OPTS)
6
6
  pandoc_html = $(pandoc) --toc -t html --no-wrap
7
7
 
8
- man1 := $(addsuffix .1,posix-mq.rb)
8
+ man1 := $(addsuffix .1,posix-mq-rb)
9
9
  html1 := $(addsuffix .html,$(man1))
10
10
 
11
11
  all:: html man
@@ -1,14 +1,14 @@
1
- % posix-mq.rb(1) posix-mq.rb User Manual
1
+ % posix-mq-rb(1) posix-mq-rb User Manual
2
2
  % Ruby POSIX MQ hackers <ruby.posix.mq@librelist.com>
3
3
  % Jan 1, 2010
4
4
 
5
5
  # NAME
6
6
 
7
- posix-mq.rb - command-line interface for POSIX message queues
7
+ posix-mq-rb - command-line interface for POSIX message queues
8
8
 
9
9
  # SYNOPSIS
10
10
 
11
- MQUEUE=/name posix-mq.rb COMMAND [*OPTIONS*] [*ARGUMENTS*]
11
+ MQUEUE=/name posix-mq-rb COMMAND [*OPTIONS*] [*ARGUMENTS*]
12
12
 
13
13
  # DESCRIPTION
14
14
 
@@ -75,7 +75,7 @@ The following command-line arguments are accepted:
75
75
 
76
76
  -n, \--nonblock
77
77
  : Exit immediately with error if the message queue is full.
78
- Normally posix-mq.rb(1) will block until the queue is writable or
78
+ Normally posix-mq-rb(1) will block until the queue is writable or
79
79
  interrupted. This may not be used in conjunction with \--timeout .
80
80
  -t, \--timeout SECONDS
81
81
  : Timeout and exit with error after SECONDS if the message queue is full.
@@ -96,7 +96,7 @@ The following command-line arguments are accepted:
96
96
 
97
97
  -n, \--nonblock
98
98
  : Exit immediately with error if the message queue is empty.
99
- Normally posix-mq.rb(1) will block until the queue is readable or
99
+ Normally posix-mq-rb(1) will block until the queue is readable or
100
100
  interrupted. This may not be used in conjunction with \--timeout .
101
101
  -t, \--timeout SECONDS
102
102
  : Timeout and exit with error after SECONDS if the message queue is empty.
@@ -111,9 +111,9 @@ The following command-line arguments are accepted:
111
111
 
112
112
  # WAIT USAGE
113
113
 
114
- The *wait* command will cause posix-mq.rb(1) to sleep until a message is
114
+ The *wait* command will cause posix-mq-rb(1) to sleep until a message is
115
115
  available in the queue. Only one process may wait on an empty queue,
116
- posix-mq.rb(1) will exit with an error if there is another waiting process.
116
+ posix-mq-rb(1) will exit with an error if there is another waiting process.
117
117
 
118
118
  It takes no arguments and accepts the following options:
119
119
 
data/GIT-VERSION-FILE CHANGED
@@ -1 +1 @@
1
- GIT_VERSION = 0.4.0
1
+ GIT_VERSION = 0.5.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=v0.3.1.GIT
4
+ DEF_VER=v0.5.0.GIT
5
5
 
6
6
  LF='
7
7
  '
data/GNUmakefile CHANGED
@@ -15,8 +15,9 @@ ifeq ($(RUBY_VERSION),)
15
15
  RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
16
16
  endif
17
17
 
18
- base_bins := posix-mq.rb
18
+ base_bins := posix-mq-rb
19
19
  bins := $(addprefix bin/, $(base_bins))
20
+ man1_rdoc := $(addsuffix _1, $(base_bins))
20
21
  man1_bins := $(addsuffix .1, $(base_bins))
21
22
  man1_paths := $(addprefix man/man1/, $(man1_bins))
22
23
 
@@ -57,7 +58,7 @@ NEWS: GIT-VERSION-FILE
57
58
  $(RAKE) -s news_rdoc > $@+
58
59
  mv $@+ $@
59
60
 
60
- SINCE =
61
+ SINCE = 0.4.0
61
62
  ChangeLog: LOG_VERSION = \
62
63
  $(shell git rev-parse -q "$(GIT_VERSION)" >/dev/null 2>&1 && \
63
64
  echo $(GIT_VERSION) || git describe)
@@ -75,10 +76,10 @@ cgit_atom := http://git.bogomips.org/cgit/ruby_posix_mq.git/atom/?h=master
75
76
  atom = <link rel="alternate" title="Atom feed" href="$(1)" \
76
77
  type="application/atom+xml"/>
77
78
 
78
- # using rdoc 2.4.1+
79
+ # using rdoc 2.5.x+
79
80
  doc: .document NEWS ChangeLog
80
- for i in $(man1_bins); do > $$i; done
81
- rdoc -Na -t "$(shell sed -ne '1s/^= //p' README)"
81
+ for i in $(man1_rdoc); do > $$i; done
82
+ rdoc -a -t "$(shell sed -ne '1s/^= //p' README)"
82
83
  install -m644 COPYING doc/COPYING
83
84
  install -m644 $(shell grep '^[A-Z]' .document) doc/
84
85
  $(MAKE) -C Documentation install-html install-man
@@ -95,7 +96,7 @@ doc: .document NEWS ChangeLog
95
96
  doc/NEWS.html doc/README.html
96
97
  $(RAKE) -s news_atom > doc/NEWS.atom.xml
97
98
  cd doc && ln README.html tmp && mv tmp index.html
98
- $(RM) $(man1_bins)
99
+ $(RM) $(man1_rdoc)
99
100
 
100
101
  ifneq ($(VERSION),)
101
102
  rfproject := qrp
data/NEWS CHANGED
@@ -1,3 +1,15 @@
1
+ === 0.5.0 / 2010-05-05 02:54 UTC
2
+
3
+ Uncommonly raised exceptions due to programmer error are now
4
+ raised more safely with respect to the MRI garbage collector.
5
+
6
+ The "posix-mq.rb" executable has been renamed to "posix-mq-rb"
7
+ to respect RPS and is also hopefully easier to type/read when
8
+ used in scripts. I'm preserving the "rb" in the name since I
9
+ hope to have a more portable, C-only version someday.
10
+
11
+ Minor cleanups and documentation now uses RDoc 2.5.x
12
+
1
13
  === 0.4.0 / 2010-03-13 09:44 UTC
2
14
 
3
15
  Small bugfixes and small API changes to avoid potential
data/README CHANGED
@@ -28,7 +28,7 @@ network-aware message queue implementations.
28
28
 
29
29
  * Documented library API
30
30
 
31
- * Includes a generic "posix-mq.rb" command-line tool with manpage.
31
+ * Includes a generic "posix-mq-rb" command-line tool with manpage.
32
32
 
33
33
  == Install
34
34
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
  # -*- encoding: binary -*-
3
3
  Encoding.default_external = Encoding::BINARY if defined?(Encoding)
4
4
  $stderr.sync = $stdout.sync = true
@@ -10,6 +10,10 @@
10
10
  #endif
11
11
  #include <ruby.h>
12
12
 
13
+ #ifndef RB_GC_GUARD
14
+ # define RB_GC_GUARD(v) (*(volatile VALUE *)&(v))
15
+ #endif
16
+
13
17
  #include <time.h>
14
18
  #include <mqueue.h>
15
19
  #include <fcntl.h>
@@ -247,9 +251,11 @@ static void attr_from_struct(struct mq_attr *attr, VALUE astruct, int all)
247
251
  {
248
252
  VALUE *ptr;
249
253
 
250
- if (CLASS_OF(astruct) != cAttr)
254
+ if (CLASS_OF(astruct) != cAttr) {
255
+ RB_GC_GUARD(astruct) = rb_inspect(astruct);
251
256
  rb_raise(rb_eArgError, "not a POSIX_MQ::Attr: %s",
252
- RSTRING_PTR(rb_inspect(astruct)));
257
+ RSTRING_PTR(astruct));
258
+ }
253
259
 
254
260
  ptr = RSTRUCT_PTR(astruct);
255
261
 
@@ -305,10 +311,12 @@ static VALUE init(int argc, VALUE *argv, VALUE self)
305
311
  x.oflags = O_CREAT|O_WRONLY;
306
312
  else if (oflags == sym_rw)
307
313
  x.oflags = O_CREAT|O_RDWR;
308
- else
314
+ else {
315
+ RB_GC_GUARD(oflags) = oflags;
309
316
  rb_raise(rb_eArgError,
310
317
  "symbol must be :r, :w, or :rw: %s",
311
- RSTRING_PTR(rb_inspect(oflags)));
318
+ RSTRING_PTR(oflags));
319
+ }
312
320
  break;
313
321
  case T_BIGNUM:
314
322
  case T_FIXNUM:
@@ -348,8 +356,9 @@ static VALUE init(int argc, VALUE *argv, VALUE self)
348
356
  case T_NIL:
349
357
  break;
350
358
  default:
359
+ RB_GC_GUARD(attr) = rb_inspect(attr);
351
360
  rb_raise(rb_eArgError, "attr must be a POSIX_MQ::Attr: %s",
352
- RSTRING_PTR(rb_inspect(attr)));
361
+ RSTRING_PTR(attr));
353
362
  }
354
363
 
355
364
  mq->des = (mqd_t)xopen(&x);
@@ -702,7 +711,7 @@ static int lookup_sig(VALUE sig)
702
711
  sig = rb_str_new(ptr + 3, len - 3);
703
712
 
704
713
  if (!list) {
705
- VALUE mSignal = rb_define_module("Signal"""); /* avoid RDoc */
714
+ VALUE mSignal = rb_const_get(rb_cObject, rb_intern("Signal"));
706
715
 
707
716
  list = rb_funcall(mSignal, rb_intern("list"), 0, 0);
708
717
  rb_global_variable(&list);
@@ -710,8 +719,7 @@ static int lookup_sig(VALUE sig)
710
719
 
711
720
  sig = rb_hash_aref(list, sig);
712
721
  if (NIL_P(sig))
713
- rb_raise(rb_eArgError, "invalid signal: %s\n",
714
- RSTRING_PTR(rb_inspect(sig)));
722
+ rb_raise(rb_eArgError, "invalid signal: %s\n", ptr);
715
723
 
716
724
  return NUM2INT(sig);
717
725
  }
data/lib/posix_mq.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- encoding: binary -*-
2
2
  class POSIX_MQ
3
3
 
4
- # version of POSIX_MQ, currently 0.4.0
5
- VERSION = '0.4.0'
4
+ # version of POSIX_MQ, currently 0.5.0
5
+ VERSION = '0.5.0'
6
6
 
7
7
  # An analogous Struct to "struct mq_attr" in C.
8
8
  # This may be used in arguments for POSIX_MQ.new and
@@ -1,10 +1,10 @@
1
- .TH posix-mq.rb 1 "Jan 1, 2010" "posix-mq.rb User Manual"
1
+ .TH posix-mq-rb 1 "Jan 1, 2010" "posix-mq-rb User Manual"
2
2
  .SH NAME
3
3
  .PP
4
- posix-mq.rb - command-line interface for POSIX message queues
4
+ posix-mq-rb - command-line interface for POSIX message queues
5
5
  .SH SYNOPSIS
6
6
  .PP
7
- MQUEUE=/name posix-mq.rb COMMAND [\f[I]OPTIONS\f[]]
7
+ MQUEUE=/name posix-mq-rb COMMAND [\f[I]OPTIONS\f[]]
8
8
  [\f[I]ARGUMENTS\f[]]
9
9
  .SH DESCRIPTION
10
10
  .PP
@@ -81,7 +81,7 @@ The following command-line arguments are accepted:
81
81
  .TP
82
82
  .B -n, --nonblock
83
83
  Exit immediately with error if the message queue is full.
84
- Normally posix-mq.rb(1) will block until the queue is writable or
84
+ Normally posix-mq-rb(1) will block until the queue is writable or
85
85
  interrupted.
86
86
  This may not be used in conjunction with --timeout \&.
87
87
  .RS
@@ -113,7 +113,7 @@ The following command-line arguments are accepted:
113
113
  .TP
114
114
  .B -n, --nonblock
115
115
  Exit immediately with error if the message queue is empty.
116
- Normally posix-mq.rb(1) will block until the queue is readable or
116
+ Normally posix-mq-rb(1) will block until the queue is readable or
117
117
  interrupted.
118
118
  This may not be used in conjunction with --timeout \&.
119
119
  .RS
@@ -139,9 +139,9 @@ following format:
139
139
  \f[]
140
140
  .SH WAIT USAGE
141
141
  .PP
142
- The \f[I]wait\f[] command will cause posix-mq.rb(1) to sleep until
142
+ The \f[I]wait\f[] command will cause posix-mq-rb(1) to sleep until
143
143
  a message is available in the queue.
144
- Only one process may wait on an empty queue, posix-mq.rb(1) will
144
+ Only one process may wait on an empty queue, posix-mq-rb(1) will
145
145
  exit with an error if there is another waiting process.
146
146
  .PP
147
147
  It takes no arguments and accepts the following options:
data/posix_mq.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.date = Time.now.utc.strftime('%Y-%m-%d')
13
13
  s.description = File.read("README").split(/\n\n/)[1]
14
14
  s.email = %q{ruby.posix.mq@librelist.com}
15
- s.executables = %w(posix-mq.rb)
15
+ s.executables = %w(posix-mq-rb)
16
16
  s.extensions = %w(ext/posix_mq/extconf.rb)
17
17
 
18
18
  s.extra_rdoc_files = File.readlines('.document').map! do |x|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posix_mq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruby POSIX MQ hackers
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-13 00:00:00 +00:00
12
+ date: 2010-05-05 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -19,7 +19,7 @@ description: |-
19
19
  message queues, but provides similar functionality.
20
20
  email: ruby.posix.mq@librelist.com
21
21
  executables:
22
- - posix-mq.rb
22
+ - posix-mq-rb
23
23
  extensions:
24
24
  - ext/posix_mq/extconf.rb
25
25
  extra_rdoc_files:
@@ -37,7 +37,7 @@ files:
37
37
  - ChangeLog
38
38
  - Documentation/.gitignore
39
39
  - Documentation/GNUmakefile
40
- - Documentation/posix-mq.rb.1.txt
40
+ - Documentation/posix-mq-rb.1.txt
41
41
  - GIT-VERSION-FILE
42
42
  - GIT-VERSION-GEN
43
43
  - GNUmakefile
@@ -45,12 +45,12 @@ files:
45
45
  - NEWS
46
46
  - README
47
47
  - Rakefile
48
- - bin/posix-mq.rb
48
+ - bin/posix-mq-rb
49
49
  - ext/posix_mq/extconf.rb
50
50
  - ext/posix_mq/posix_mq.c
51
51
  - lib/posix_mq.rb
52
52
  - local.mk.sample
53
- - man/man1/posix-mq.rb.1
53
+ - man/man1/posix-mq-rb.1
54
54
  - posix_mq.gemspec
55
55
  - setup.rb
56
56
  - test/test_posix_mq.rb