1 = posix_mq - POSIX Message Queues for Ruby
3 POSIX message queues allow local processes to exchange data in the form
4 of messages. This API is distinct from that provided by System V
5 message queues, but provides similar functionality.
7 POSIX message queues may be implemented in the kernel for fast,
8 low-latency communication between processes on the same machine.
9 POSIX message queues are not intended to replace userspace,
10 network-aware message queue implementations.
14 * Supports message notifications via signals on all platforms
16 * Supports portable non-blocking operation. Under Linux 2.6.6+ and
17 FreeBSD 7.2+, POSIX_MQ objects may even be used with event
18 notification mechanisms such as IO.select.
20 * Supports notifications via block execution in a separate thread
21 on platforms that implement SIGEV_THREAD for mq_notify(3),
22 currently only GNU/Linux.
24 * Optional timeouts may be applied to send and receive operations.
26 * Thread-safe blocking operations under Ruby 1.9, releases GVL
27 before blocking operations.
29 * Documented library API
31 * Includes a generic "posix-mq-rb" command-line tool with manpage.
35 Operating system support (or library emulation) for POSIX message queues
36 is required. Most modern GNU/Linux distributions support this
39 If you're using a packaged Ruby distribution, make sure you have a C
40 compiler and the matching Ruby development libraries and headers.
42 If you plan on using the command-line client, a tarball installation
43 starts up faster and is recommended. Just grab the tarball from:
45 http://bogomips.org/ruby_posix_mq/files/
46 Unpack it, and run "ruby setup.rb"
48 Otherwise, via RubyGems: gem install posix_mq
52 The Linux mq_overview(7)
53 {manpage}[http://kernel.org/doc/man-pages/online/pages/man7/mq_overview.7.html]
54 provides a good overview of programming with POSIX message queues.
56 Under FreeBSD, you must load the
57 {mqueuefs(5)}[http://freebsd.org/cgi/man.cgi?query=mqueuefs]
58 kernel module before attempting to use POSIX message queues:
62 Our API matches the C api closely, see the RDoc for full API
63 documentation. Here is an example of a process communicating
64 with itself. In practice, processes that send will be different
65 from processes that receive.
68 mq = POSIX_MQ.new("/foo", :rw)
72 puts mq.receive.first # => should print "hello world"
74 # non-blocking operation
81 trap(:USR1) { puts mq.receive.first }
83 mq.send "fire USR1 handler"
84 # "fire USR1 handler" should be printed now
88 You can get the latest source via git from the following locations:
90 git://git.bogomips.org/ruby_posix_mq.git
91 git://repo.or.cz/ruby_posix_mq.git (mirror)
93 You may browse the code from the web and download the latest snapshot
96 * http://git.bogomips.org/cgit/ruby_posix_mq.git (cgit)
97 * http://repo.or.cz/w/ruby_posix_mq.git (gitweb)
99 Inline patches (from "git format-patch") to the mailing list are
100 preferred because they allow code review and comments in the reply to
103 We will adhere to mostly the same conventions for patch submissions as
104 git itself. See the Documentation/SubmittingPatches document
105 distributed with git on on patch submission guidelines to follow. Just
106 don't email the git mailing list or maintainer with posix_mq patches.
110 All feedback (bug reports, user/development discussion, patches, pull
111 requests) go to the mailing list: mailto:ruby.posix.mq@librelist.com
113 == Mailing List Archives
115 In addition to the rsync-able archives provided by http://librelist.com/, we
117 {Gmane}[http://gmane.org/info.php?group=gmane.comp.lang.ruby.posix-mq.general]
118 and maintain our own mbox mirrors downloadable via HTTP.
120 * nntp://news.gmane.org/gmane.comp.lang.ruby.posix-mq.general
121 * http://bogomips.org/ruby_posix_mq/archives/