# About
xchan.rb is an easy to use, minimalist library for InterProcess
Communication (IPC). The library provides a channel that can help
facilitate communication between Ruby processes who have a parent <=>
child relationship. A channel lock is provided by lockf(3) and a
temporary, unlinked file to protect against race conditions that can
happen when multiple processes access the same channel at the same time.
# Features
* Minimalist IPC for parent <=> child processes.
* Channel-based communication.
* Support for multiple serializers (`:marshal`, `:json`, `:yaml`)
* Support for raw string communication (`:pure`).
* Blocking (`#send`, `#recv`) operations
* Non-blocking (`#send_nonblock`, `#recv_nonblock`) operations.
* Built-in file-based locking (lockf(3))
* Option to use a null lock for scenarios where locking is not needed.
* Access to underlying UNIX sockets for control over socket options.
* Mac, BSD, and Linux support.
* Good docs.
# Example
#!/usr/bin/env ruby
require "xchan"
ยทยทยท
##
# Marshal as the serializer
ch = xchan(:marshal)
Process.wait fork { ch.send(5) }
puts "#{ch.recv} + 7 = 12"
ch.close
##
# 5 + 7 = 12
# Links
Best regards,
Robert
______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.org/