posix_mq RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [RFC] try* interfaces in posix_mq 0.8.0pre
@ 2011-02-27 11:26 Eric Wong
  2011-02-27 14:44 ` Iñaki Baz Castillo
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Wong @ 2011-02-27 11:26 UTC (permalink / raw)
  To: ruby.posix.mq

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-27 23:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-27 11:26 [RFC] try* interfaces in posix_mq 0.8.0pre Eric Wong
2011-02-27 14:44 ` 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

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).