LATEST in posix_mq-0.7.0 vs LATEST in posix_mq-0.8.0pre

- old
+ new

@@ -1,12 +1,25 @@ -=== posix_mq 0.7.0 - cleanups + portability fixes / 2011-02-24 00:32 UTC +=== posix_mq 0.8.0pre - kinder, gentler and less exceptional / 2011-02-27 11:13 UTC - This release now works for systems other than Linux and FreeBSD - that support POSIX message queues. This is usable for systems - without mq_timedsend() or mq_timedreceive() but with the - non-timed variants (timeouts wont work). + 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. - Thanks to Tadeusz Bochan for testing. + 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... - Ruby posix_mq is now dual-licensed under the GPLv2 (as well as the - preferred LGPLv3) for compatibility with existing GPLv2-only code. + 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.