From: Eric Wong <normalperson@yhbt.net>
To: ruby.posix.mq@librelist.org
Subject: [RFC] try* interfaces in posix_mq 0.8.0pre
Date: Sun, 27 Feb 2011 11:26:12 +0000 [thread overview]
Message-ID: <20110227112612.GA23802@dcvr.yhbt.net> (raw)
In-Reply-To: <20110227112612.GA23802@dcvr.yhbt.net>
I just pushed this out to RubyGems.org (and ruby_posix_mq.git).
Let us know what you think, thanks!
posix_mq 0.8.0pre - kinder, gentler and less exceptional
This adds trysend, tryreceive, and tryshift interfaces to avoid
exceptions on common EAGAIN errors for non-blocking users. EAGAIN
during non-blocking messages is common when there are multiple
readers/writer threads/processes working on the same queue.
trysend is like send, except it returns true for success and false for
EAGAIN. send (still) returns nil, which I now consider a mistake but
won't change until post-1.0...
tryreceive and tryshift are like receive and shift respectively,
but they return nil for EAGAIN and the same return values
for their non-shift variants.
None of these methods call mq_setattr() beforehand to set the
non-blocking flag, it assumes the user set it once before they were ever
called and never changes it. Checking/setting the non-blocking flag
every time is needless overhead and still subject to race conditions if
multiple processes/queues keep flipping flag on the same queue
descriptor.
These interfaces are not yet final, feedback is appreciated
at ruby.posix.mq@librelist.org.
--
Eric Wong
next parent reply other threads:[~2011-02-27 11:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-27 11:26 Eric Wong [this message]
2011-02-27 14:44 ` [RFC] try* interfaces in posix_mq 0.8.0pre Iñaki Baz Castillo
2011-02-27 15:01 ` Iñaki Baz Castillo
2011-02-27 16:15 ` Iñaki Baz Castillo
[not found] ` <20110227222400.GB31726@dcvr.yhbt.net>
[not found] ` <AANLkTins0SjXeC6XBczdWakMo1e5pQSd9mo9EkjQ+E2e@mail.gmail.com>
2011-02-27 23:23 ` Iñaki Baz Castillo
2011-02-27 23:51 ` Eric Wong
2011-02-27 22:27 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/ruby_posix_mq/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110227112612.GA23802@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--cc=ruby.posix.mq@librelist.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/ruby_posix_mq.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).