ChangeLog from http://bogomips.org/ruby_posix_mq.git commit 330846614470a64f34b671852ce4bf0f789aeb62 Author: Eric Wong Date: Sun Feb 27 11:11:19 2011 +0000 bump version to 0.8.0pre Remove the VERSION constant, it's cruft. commit 0f6696bb05f0b23dac8ddbe9c25233f7daf744b1 Author: Eric Wong Date: Sun Feb 27 10:59:09 2011 +0000 doc: fix doc generation for manpage Oops commit b78572aebcf764d314844caff43c438cc93257fc Author: Eric Wong Date: Sun Feb 27 10:54:42 2011 +0000 add trysend, tryreceive, and tryshift interfaces These are kinder and less exceptional than their non-trying counterparts as generating exceptions is expensive for common EAGAIN errors. commit fe77abb7dc4dbe6fb4054430ff7fceb98f5dc9b8 Author: Eric Wong Date: Sun Feb 27 10:19:13 2011 +0000 eliminate needless global (cPOSIX_MQ) It can be local variable commit 8595f845b3903907adaa614443a582179e5da22a Author: Eric Wong Date: Sun Feb 27 10:11:34 2011 +0000 run GC on ENOSPC when calling mq_open() It could work... commit b4a8788ea8768574dd7a5d109bff8ece072d3873 Author: Eric Wong Date: Sun Feb 27 10:08:48 2011 +0000 Symbols are VALUEs, not IDs Oops :x commit 6d336b465a9ff86b933949ebc7a58aeb717bda36 Author: Eric Wong Date: Sun Feb 27 09:59:11 2011 +0000 tests: do not require Fiddle for Ruby 1.9 It's only available when compiled with libffi. commit 6d22887be14c6f543d86425545e79eff92d97714 Author: Eric Wong Date: Sun Feb 27 09:56:34 2011 +0000 Do not trust locally cached mq_flags These flags can be changed in the parent or child process, so we will always have to run mq_getattr() to check it. This removes the GVL-keeping non-blocking optimizations but we'll gain some soon. commit c02944edaed780bb20ad98ecdd11463d945b36ca Author: Eric Wong Date: Wed Feb 23 20:52:26 2011 -0800 cleanup DL usage for alarm() test commit c57db265632314a663268aceb1213ce6a7d8c83f Author: Eric Wong Date: Wed Feb 23 20:43:09 2011 -0800 fix test alarm() case for Ruby 1.9 DL in Ruby 1.9 isn't the same commit c3d0e079729eedbccd6f8ddee0bdac9ae9fdcc6b Author: Eric Wong Date: Wed Feb 23 16:09:46 2011 -0800 posix_mq 0.7.0 - cleanups + portability fixes 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). Thanks to Tadeusz Bochan for testing. Ruby posix_mq is now dual-licensed under the GPLv2 (as well as the preferred LGPLv3) for compatibility with existing GPLv2-only code. commit 909cf19949cab04cd7c223830e93291f1d5517f5 Author: Eric Wong Date: Wed Feb 23 16:31:16 2011 -0800 doc: full rdoc coverage! commit af97f65ef9968f3f365b85e262965b5fd3c6776c Author: Eric Wong Date: Wed Feb 23 16:25:57 2011 -0800 doc: add copy of GPLv2 For completeness, the LGPLv3 remains the preferred license. commit 76e4b6e72d717b69843f4c43665bb0c55ac58eea Author: Eric Wong Date: Wed Feb 23 16:19:16 2011 -0800 doc: note that timeout is not always supported Maybe people will just upgrade to newer systems eventually. commit 28b863232bb1c96df9af9e35c5fffeec8d9b69c0 Author: Eric Wong Date: Wed Feb 23 16:05:36 2011 -0800 README: update mailing list notes If it's not clear, we hate HTML. commit 0602e5e2f941128ad1330b45eaf48ea65b5e7327 Author: Eric Wong Date: Wed Feb 23 15:30:02 2011 -0800 added a note about em-posixmq for EventMachine users ref: http://mid.gmane.org/AANLkTimNcWKqNSbD5GL76Z9rS3Gfi3uGusPksD2Eo+=P@mail.gmail.com commit 1fdd73c1d006cf96fd7955f171df70ad5d0fe896 Author: Eric Wong Date: Wed Feb 23 15:26:40 2011 -0800 doc: discourage the use of notify POSIX_MQ#notify(&block) mostly sucks. commit 0d3f4d41cedc59c4b3cf000f0e05bc1245be8ad3 Author: Eric Wong Date: Wed Feb 23 15:21:55 2011 -0800 unindent class methods No need to waste indentation and make eyes wander. commit b6d82cdeff1ea2822c2911adf61d6a00538ecba8 Author: Eric Wong Date: Wed Feb 23 20:11:18 2011 +0000 test for alarm() working properly to interrupt Some systems without mq_timedsend/mq_timedreceive need to use alarm() or similar (setitimer()) to interrupt timed-out mq_send/mq_receive calls, so we need to handle EINTR properly. commit 634a6f450f0a145f6248d5918c4eb3d0ded6f6dc Author: Eric Wong Date: Wed Feb 23 19:46:53 2011 +0000 update URLs for git and cgit While the old URLs still work, bogomips.org went on a URL diet commit 72171f4ba79e5cbb6eb82f0f243cf554f643e796 Author: Eric Wong Date: Wed Feb 23 19:43:38 2011 +0000 fix MQ_IO_NIL_P and MQ_IO_CLOSE macros These cannot be cast to void since its value is meaningful. commit 07feaee646e061f27dceccc1c06262c2e832f560 Author: Eric Wong Date: Wed Feb 23 19:42:58 2011 +0000 test: fix GC test for systems without POSIX_MQ#to_io Not all systems can convert POSIX_MQ to IO objects. commit dbded16e7c36b51187f3d0e6981c96773f910de9 Author: Eric Wong Date: Tue Feb 22 17:42:02 2011 -0800 LICENSE: dual license, adding GPLv2 This makes us explicitly compatible with GPLv2-only programs. commit 3a8a20d685dbfb500187099d76e56e848ad347ed Author: Eric Wong Date: Tue Feb 22 16:46:26 2011 -0800 attempt to support systems w/o mq_timedsend/mq_timedreceive Some ancient systems don't support mq_timedsend and mq_timedreceive but somehow manage to support other POSIX mq_* functions. commit c4c4554c3ceef9208fe7f8473b970e9f522ab9b9 Author: Eric Wong Date: Tue Feb 22 15:41:22 2011 -0800 extconf: remove unnecessary dir_config statement It's all standard C library stuff. commit 5f1578c0d17b05f5158e467bd3abf18565fe1b4b Author: Eric Wong Date: Tue Feb 22 15:32:40 2011 -0800 use StringValueCStr for paths RSTRING_PTR may contain '\0' bytes which makes it unsuitable for mq_unlink() and mq_open() commit a5491670078b045ced2641649a6cfceee2cade10 Author: Eric Wong Date: Tue Feb 22 15:02:31 2011 -0800 fix broken rb_str_set_len() #define for Ruby 1.8.6 This was too aggressively deleted during cleanups for Rubinius support in commit 5339d9d693c794c0f20270d5726cb360e31dff30 Noticed-by: Tadeusz Bochan ref: 2a92695fc1958e0370782284c6196625@ruby-forum.com commit 7144a4e325f77e3fa41ade00f5cef5612908a7e9 Author: Eric Wong Date: Tue Feb 22 14:50:59 2011 -0800 fix for systems that can't convert mqd_t to FD Apparently there are OSes that don't have methods to convert mqd_t to FD. Noticed-by: Tadeusz Bochan ref: <2a92695fc1958e0370782284c6196625@ruby-forum.com> commit de45521943e838122a82492ec03c58b78b6adf1e Author: Eric Wong Date: Tue Feb 22 14:39:31 2011 -0800 switch to pkg.mk for packaging needs I can't stand Rake :x commit 9edc6946bbd4cc4be55ca4293135189c3db356c6 Author: Eric Wong Date: Sun Dec 26 01:25:27 2010 +0000 publish_news target is less braindead Run it by default on releases. commit 88e85b58f3cb0796a680c86d83c16c305c33b098 Author: Eric Wong Date: Sat Dec 25 00:23:03 2010 -0800 posix_mq 0.6.0 - Rubinius support Rubinius 1.2 as well as Ruby 1.9. Ruby 1.8 works except it will block the entire interpreter for blocking operations. Spurious errors during GC for POSIX_MQ#to_io users are now avoided. commit 2384ecce25e91feb1ec0a9537c76beb18a7d4f86 Author: Eric Wong Date: Sat Dec 25 00:19:49 2010 -0800 switch to wrongdoc for documentation No more JavaScript on our site! commit 5339d9d693c794c0f20270d5726cb360e31dff30 Author: Eric Wong Date: Fri Dec 24 23:56:07 2010 -0800 add Rubinius support Cleaner code, too, no more direct RSTRUCT usage. commit 79583aaa426ac2f0967cb84524b6e17d72499cd5 Author: Eric Wong Date: Fri Dec 24 23:24:29 2010 -0800 refactor type checks and remove unnecessary guards StringValuePtr should already be a sufficient guard. There are more tests while we're at it, too, and we'll now raise TypeError instead of ArgumentError when a POSIX_MQ::Attr is not passed properly. commit 31dee76d5ef41ec5524c3e4dfb802db4a7a468ef Author: Eric Wong Date: Fri Dec 24 18:11:04 2010 -0800 remove rb_time_interval() and gettimeofday() dependency This function isn't exported in the standard Ruby headers, it returns an aggregate value and isn't available in Rubinius, either, so nuke it. While we're at it, use clock_gettime() instead of gettimeofday() to avoid unnecessary timeval usage since mq_send/mq_receive rely on higher-precision timespecs instead. commit 748d4aa2d3ece18db7d48c355ce77c877e4d3bb9 Author: Eric Wong Date: Thu Aug 19 19:37:32 2010 -0700 tests: use Class#method_defined? I did not know about this method back in the day... commit 8f5be0c822362e113919145d52b9eeebba711236 Author: Eric Wong Date: Thu Aug 19 19:36:23 2010 -0700 test: avoid leaving queues behind We shouldn't unnecessarily hog system resources. commit cea38abf1f76b5b795b9341406ee814303f5752b Author: Eric Wong Date: Thu Aug 19 19:25:58 2010 -0700 avoid double close() and EBADF It can be dangerous to hit (and ignore) EBADF errors in multi-threaded applications. Users of POSIX_MQ#to_io have two Ruby objects pointing to the same file descriptor, making things tricky when it comes time to reap resources. We'll always prefer to close the Ruby IO object if it exists (because we have less control over its GC behavior) and ignore the raw descriptor. commit 3cf7ec34b6319693af14215ebb0da51c3e6a4603 Author: Eric Wong Date: Mon Aug 2 08:28:15 2010 +0000 open/notify: invoke GC if needed On ENOMEM, EMFILE, and ENFILE errors, it is customary to invoke the Ruby GC and free up resources and retry the system call. commit 3ca83d322486bb3da20d974af7faa74f9df891d8 Author: Eric Wong Date: Sun May 9 01:05:56 2010 -0700 posix_mq 0.5.1 Fix POSIX_MQ#notify(&block) usage, this regression was introduced in 0.4.0 and our tests for it were broken, as well. commit a997f4822a99590c7a5175be4a694b4482a4b997 Author: Eric Wong Date: Sun May 9 00:05:03 2010 -0700 fix POSIX_MQ#notify(&block) aka SIGEV_THREAD tests for them were stupidly broken and never executed :x commit f3605c820fd73713e34950170bf759e1af204038 Author: Eric Wong Date: Tue May 4 19:48:18 2010 -0700 posix_mq 0.5.0 Uncommonly raised exceptions due to programmer error are now raised more safely with respect to the MRI garbage collector. The "posix-mq.rb" executable has been renamed to "posix-mq-rb" to respect RPS and is also hopefully easier to type/read when used in scripts. I'm preserving the "rb" in the name since I hope to have a more portable, C-only version someday. Minor cleanups and documentation now uses RDoc 2.5.x commit f4d7d9d14cf65595aa3d98429a6732bd6b007b4a Author: Eric Wong Date: Tue May 4 19:37:37 2010 -0700 doc: updates for RDoc 2.5.x commit 7b1b8a1cbbedc2764d4a8ab0d992f9f2ef73d9b7 Author: Eric Wong Date: Tue May 4 19:31:47 2010 -0700 rename `posix-mq.rb' executable to `posix-mq-rb' ".rb" in the executable name is discouraged by the {Ruby packaging standard}[http://github.com/chneukirchen/rps] and probably confusing. If I ever get around to it, a non-Ruby version of this executable is planned, and that will be called "posix-mq" commit 33368c839dc8c63489591bda6e60c78025be8852 Author: Eric Wong Date: Thu Apr 22 00:02:25 2010 -0700 GC safety fixes Avoid the RSTRING_PTR(rb_inspect(val)) construct, as it may not preserve the value of rb_inspect() on the stack. commit a9a365326ea0f7a37852d25adfb03049c0b24c22 Author: Eric Wong Date: Wed Apr 21 23:58:25 2010 -0700 cleaner lookup "Signal" of constant Instead of blindly defining a module, this is more flexible in case Signal in Ruby itself becomes something other than a module. commit aa9beecf64739ea084158ff63a92f626bfb5717d Author: Eric Wong Date: Sat Mar 13 00:28:14 2010 -0800 posix_mq 0.4.0 Small bugfixes and small API changes to avoid potential issues/misuse are the focus of this release. For non-blocking operation, the GVL is no longer bounced. This reduces synchronization/scheduling overhead when used in non-blocking applications. Small cleanups and documentation improvements, too. * make POSIX_MQ#dup and POSIX_MQ#clone no-op * do not release GVL for non-blocking operations * do not release GVL when unlinking/opening * POSIX_MQ#<< does not release GVL when non-blocking * avoid shadow warnings * README: add mailing list archives info * POSIX_MQ#to_io works under FreeBSD, too * fix potential race with notify(&block) * add TODO item for using netlink under Linux * remove non-portable #warning CPP directive * ensure POSIX_MQ#name is clobber-proof commit 437cbe78cb0f239e34f9dbf1341f5b85f96f2f25 Author: Eric Wong Date: Sat Mar 13 00:22:22 2010 -0800 ensure POSIX_MQ#name is clobber-proof We don't want folks to accidentally clobber the value for others, so allocate a new string object for it (don't worry, rb_str_dup() is cheap in 1.9). commit 74e1f75b238416d9ac402f291431a5e457ae313f Author: Eric Wong Date: Sat Mar 13 00:08:37 2010 -0800 remove non-portable #warning CPP directive There's a good chance they're not using GCC if they're on some weird platform that we'd emit a warning for. commit 9881f136858ac8f3a77a6cea8ce15b1cdb4ad55a Author: Eric Wong Date: Tue Mar 2 22:47:29 2010 -0800 add TODO item for using netlink under Linux commit 19668b0edc9b09cfd72247f7041390e0328032a0 Author: Eric Wong Date: Tue Mar 2 21:20:28 2010 -0800 fix potential race with notify(&block) We need to assign the notify_thread before assigning the notification. Otherwise, there's a chance the notification could fire and the notify_thread is not properly assigned for the POSIX_MQ object when the pipe becomes readable. commit 0f4a8ef81479f9eff9037011d81b96cf402cbe7b Author: Eric Wong Date: Sat Feb 20 17:36:16 2010 -0800 POSIX_MQ#to_io works under FreeBSD, too commit 44cd880c96a76d43f6dcc7f7cdf7f687e32bda0c Author: Eric Wong Date: Sat Feb 20 17:35:08 2010 -0800 README: add mailing list archives info commit 4b56e475483454cd6616dd3c310c251940e9368b Author: Eric Wong Date: Sat Feb 20 17:19:52 2010 -0800 avoid shadow warnings commit 97ef1cfd699640e40d2d63746d005f4f4cf6a863 Author: Eric Wong Date: Sat Feb 20 14:52:16 2010 -0800 POSIX_MQ#<< does not release GVL when non-blocking Missed this with the other change commit 5849a3ca8e0691a7f39c5cdbfc09fc34ee4da308 Author: Eric Wong Date: Sat Feb 20 14:46:04 2010 -0800 do not release GVL when unlinking/opening Since the message queue is not actually on a (slow) block device, it's unlikely to block in a way where other tasks may be scheduled by the kernel. So avoid complicating things and unnecessary task switching and assume mq_open/mq_unlink can be executed as fast as the CPU/memory subsystems allows. commit a90d0f97c9eb5d9683af09b60ef7af9e94a255c3 Author: Eric Wong Date: Sat Feb 20 14:40:16 2010 -0800 do not release GVL for non-blocking operations There's no point in wasting cycles releasing and reacquiring a lock when we know we won't block. Since most non-blocking users are expected to be single/few-threaded processes, this will likely help them. commit 67a59023164bc039129b34a742f06ba376687684 Author: Eric Wong Date: Wed Feb 17 00:37:43 2010 -0800 make POSIX_MQ#dup and POSIX_MQ#clone no-op It'll cause problems for the automatic mq_close() during GC otherwise, as dup(2) on an mqd_t isn't portable. Of course there's no point in cloning or duping, either, as mq_send/mq_receive operations are always atomic at the kernel level and only one thread can have a notification registered for it. commit 05e577616b74bea99a0e43e07f28823ddda1aaf9 Author: Eric Wong Date: Sat Feb 13 03:39:17 2010 -0800 posix_mq 0.3.1 This fixes a misuse of the Ruby API leading to memory leaks in cases where message queues are continually opened and closed throughout the lifetime of the application. Fortunately applications have little reason to repeatedly open and close message queue descriptors: they are multi-thread/multi-process-safe in every way imaginable and also capable of non-blocking operation. commit 9adbee0ab71bf408db5c3befb43b2bab0d86ebb2 Author: Eric Wong Date: Sat Feb 13 03:30:44 2010 -0800 use GC correctly and avoid memory leaks We still need to explicitly free the pointer we're given, and not just close the associated file descriptor. Fortunately most people to not spend all day opening/closing message queue descriptors so this leak may not be noticeable. commit c07cf2979036b9550566d59d6d4899be98f3e553 Author: Eric Wong Date: Thu Jan 21 20:44:22 2010 -0800 add #shift test with destination buffer commit 1d0bf6f1d39e085948008c2c6d381ed929ac109e Author: Eric Wong Date: Sat Jan 9 15:16:40 2010 -0800 Rakefile: fix raa_update task commit 2e420820d3b3fb228c810937539f95a618a2c271 Author: Eric Wong Date: Sat Jan 9 22:52:27 2010 +0000 posix_mq 0.3.0 This release adds a few new API methods, fixes MRI 1.8.6 support. We should now have full feature parity with underlying POSIX message queue C API. * POSIX_MQ#notify(&block) RDoc: http://bogomips.org/ruby_posix_mq/POSIX_MQ.html#M000001 This is only supported on platforms that implement SIGEV_THREAD with mq_notify(3) (tested with glibc + Linux). Other platforms will have to continue to rely on signal notifications via POSIX#notify=signal, or IO notifications in FreeBSD (and Linux). * POSIX_MQ#shift([buffer [,timeout]]) Shorthand for the common "POSIX_MQ#receive.first" when you do not care for priority of the received message. Rev, EventMachine and Reactor support are planned for Linux, FreeBSD and possibly any other platforms where POSIX message queues are implemented with a file descriptor. commit 2c71257b2b95e737088726ffc963b4e72f1b5455 Author: Eric Wong Date: Sat Jan 9 22:49:49 2010 +0000 MRI 1.8 does not have rb_str_flush It's Rubinius-specific and we use rb_str_resize there anyways... commit 531106e51e519458d37bed3721da4eff2f163206 Author: Eric Wong Date: Fri Jan 8 11:30:49 2010 -0800 no point in non-blocking for fd notifications It's not needed since the native thread will retry in the unlikely case of EINTR/EAGAIN. And writing one byte to a pipe that's guaranteed by POSIX to be at least 512 bytes is highly unlikely. It's also bad because F_SETFL takes the big kernel lock under Linux (and possibly other systems), and doing it unnecessarily is a waste of system cycles. commit d03c76ae11ca6294e05262df747e4d43822ada73 Author: Eric Wong Date: Fri Jan 8 11:25:06 2010 -0800 mode_t is usually unsigned Most used open modes are well under INT_MAX, however commit b3c31cf444e2ca3dae0f6d2370944bfbf3382d88 Author: Eric Wong Date: Thu Jan 7 01:45:25 2010 -0800 add POSIX_MQ#shift helper method This acts like POSIX_MQ#receive but only returns the message without the priority. commit 3700db51399e4949ed314ad0545d037b7762064e Author: Eric Wong Date: Thu Jan 7 09:28:57 2010 +0000 POSIX_MQ#notify only works on GNU/Linux for now SIGEV_THREAD is not easy to implement, so many platforms do not implement it. commit 40d61f55ac53e3cd2f229d0b032da03032e3d53d Author: Eric Wong Date: Thu Jan 7 00:37:57 2010 -0800 POSIX_MQ#notify block execution on message received This is implementation uses both a short-lived POSIX thread and a pre-spawned Ruby Thread in a manner that works properly under both Ruby 1.8 (green threads) and 1.9 (where Ruby Threads are POSIX threads). The short-lived POSIX thread will write a single "\0" byte to a pipe the Ruby Thread waits on. This operation is atomic on all platforms. Once the Ruby Thread is woken up from the pipe, it will execute th block given to it. This dual-thread implementation is inspired by the way glibc implements mq_notify(3) + SIGEV_THREAD under Linux where the kernel itself cannot directly spawn POSIX threads. commit d8c8fb4155c1feea454abc3ed3f0a4b26e90be68 Author: Eric Wong Date: Sun Jan 3 05:26:00 2010 +0000 fix warnings on platforms where mqd_t != int The POSIX manpages specify the return values of all mq_* functions besides mq_open(3) to be "int", not "mqd_t". commit dbe5ed46e07b853e79e44141924a0166016e3e44 Author: Eric Wong Date: Sat Jan 2 23:19:34 2010 -0800 bump GIT-VERSION-GEN Shouldn't affect most people since they should just take code from git... commit fd2fcdeee6b44f7854255cb7e01c81db3cd2d99c Author: Eric Wong Date: Sun Jan 3 05:46:45 2010 +0000 posix_mq 0.2.0 This release fixes notification (un)registration and should be fully-supported on modern FreeBSD (7.2+) releases. POSIX_MQ#notify=nil correctly unregister notification requests. POSIX_MQ#notify=false now provids the no-op SIGEV_NONE functionality. Under FreeBSD, using IO.select on POSIX_MQ objects is now possible as it has always been under Linux. commit 350bfc831938d84cc2d478f2cf88583863cb64fb Author: Eric Wong Date: Sun Jan 3 05:35:50 2010 +0000 support POSIX_MQ#to_io under FreeBSD FreeBSD implements an __mq_oshandle(mqd_t mqd) function to convert mqd_t to integer file descriptors. commit 26015d39e9c848a536b4ea44802f858a4e6e74f7 Author: Eric Wong Date: Sun Jan 3 04:17:56 2010 +0000 fix build under FreeBSD 7.2 FreeBSD seems to need some files explicitly included. commit e7ac70686b3c09953f6c41966dbd77f77368a9ec Author: Eric Wong Date: Sat Jan 2 21:19:58 2010 -0800 doc: FreeBSD-specific notes + example code commit 6f24b5626f89fbb6445c0943ba71f56c8945e18f Author: Eric Wong Date: Sat Jan 2 20:41:39 2010 -0800 Fix mq.notify = nil to unregister notifications "mq.notify = false" also works now, doing what "mq.notify = nil" used to do (using SIGEV_NONE). I was confused by SIGEV_NONE usage vs using a NULL pointer for the notification passed mq_notify(3). SIGEV_NONE does not actually unregister, it registers a no-op notification which prevents other processes from taking us. This also fixes the test case to pass under both Linux and FreeBSD. commit 522d4d1472c216bd95a16ca5b118bc14693aad64 Author: Eric Wong Date: Sat Jan 2 02:33:23 2010 -0800 initial commit