Transport Ruby objects between processes.
Ruby
Pull request Compare This branch is even with Epictetus:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gemtest
.gitignore
.travis.yml
.yardopts
Gemfile
LICENSE.txt
README.md
Rakefile
iprocess.gemspec

README.md

OVERVIEW

Project IProcess
Homepage https://github.com/robgleeson/IProcess
Documentation http://rubydoc.info/gems/iprocess/frames
Author Rob Gleeson

DESCRIPTION

IProcess, short for Inter Process Communication(IPC) Process, is a collection of classes you can use to transport Ruby objects between processes running on UNIX-like operating systems.

EXAMPLES

The first two examples(one & two) are using the synchronous APIs, a little below those(3) demos the asynchronous API.

1.

A single subprocess is spawned:

message = IProcess.spawn { [:yes, :no] }
p message # => [[:yes, :no]]

2.

A unit of work does not need to be a block, though, and the number of subprocesses you can spawn is variable (5, in this example):

class Worker
  def initialize
    @num = 1
  end

  def call
    @num + 1
  end
end

IProcess.spawn(5, Worker.new) # => [2, 2, 2, 2, 2]

3.

A single subprocess is spawned asynchronously.
When the subprocess completes, ':hi' is sent to obj#recv from another thread.

obj = Object.new
def obj.recv(msg)
  msg.to_s.captialize!
end

jobs = IProcess.spawn! { :hi }
jobs.map { |job| job.defer(obj) }

PLATFORM SUPPORT

supported

  • Rubinius (1.9 mode)
  • CRuby (1.9)

unsupported

  • CRuby 1.8
  • MacRuby
  • JRuby

INSTALL

gem install iprocess