From d64ac2686c3c1ff1eea4534100dca8fd73228a62 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Mar 2011 08:51:28 +0000 Subject: POSIX_MQ#send returns +true+ on success This is to be consistent with POSIX_MQ#trysend --- ext/posix_mq/posix_mq.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ext/posix_mq/posix_mq.c') diff --git a/ext/posix_mq/posix_mq.c b/ext/posix_mq/posix_mq.c index e9ae590..73cd815 100644 --- a/ext/posix_mq/posix_mq.c +++ b/ext/posix_mq/posix_mq.c @@ -509,9 +509,10 @@ static void setup_send_buffer(struct rw_args *x, VALUE buffer) } static VALUE _send(int sflags, int argc, VALUE *argv, VALUE self); + /* * call-seq: - * mq.send(string [,priority[, timeout]]) => nil + * mq.send(string [,priority[, timeout]]) => true * * Inserts the given +string+ into the message queue with an optional, * unsigned integer +priority+. If the optional +timeout+ is specified, @@ -524,7 +525,7 @@ static VALUE _send(int sflags, int argc, VALUE *argv, VALUE self); */ static VALUE my_send(int argc, VALUE *argv, VALUE self) { - _send(0, argc, argv, self); + return _send(0, argc, argv, self); } static VALUE _send(int sflags, int argc, VALUE *argv, VALUE self) @@ -549,7 +550,7 @@ static VALUE _send(int sflags, int argc, VALUE *argv, VALUE self) rb_sys_fail("mq_send"); } - return (sflags & PMQ_TRY) ? Qtrue : Qnil; + return Qtrue; } /* @@ -558,6 +559,10 @@ static VALUE _send(int sflags, int argc, VALUE *argv, VALUE self) * * Inserts the given +string+ into the message queue with a * default priority of 0 and no timeout. + * + * Returns itself so its calls may be chained. This use is only + * recommended only for users who expect blocking behavior from + * the queue. */ static VALUE send0(VALUE self, VALUE buffer) { -- cgit v1.2.3-24-ge0c7