about summary refs log tree commit homepage
path: root/ext/posix_mq/posix_mq.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-03-01 08:51:28 +0000
committerEric Wong <normalperson@yhbt.net>2011-03-01 08:51:28 +0000
commitd64ac2686c3c1ff1eea4534100dca8fd73228a62 (patch)
tree2be905118531810e1eb0be2574b862426e06f771 /ext/posix_mq/posix_mq.c
parentae1acbcc32aef9efd23daed0611e2919aa0e5037 (diff)
downloadruby_posix_mq-d64ac2686c3c1ff1eea4534100dca8fd73228a62.tar.gz
This is to be consistent with POSIX_MQ#trysend
Diffstat (limited to 'ext/posix_mq/posix_mq.c')
-rw-r--r--ext/posix_mq/posix_mq.c11
1 files changed, 8 insertions, 3 deletions
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)
 {