Sha256: e2bab5b69cac5367c5a4f39b7579d005e61946fa9dcd00c308313dce4984e1fa

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

# Chattyproc

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'chattyproc'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install chattyproc

## Usage

Right now ChattyProc only includes a single process communication method - a pipe server. The idea behind the pipe server is that a process can communicate back and forth with processes that it forks. Here's a quick example:

    require "chattyproc"
		
		# Set up the pipe server
		ps = ChattyProc::PipeServer.new
		
		# Fork a new process
		fork do
			# Mark this process as the callee
			ps.callee!
			
			message = ps.read
			ps.write("Hello #{message}")
		end
		
		# Mark this process as the caller
		ps.caller!
		
		# Send a message over to the other process
		ps.write("Alan")
		
		# Print the response
		response = ps.read
		
		# Wait for the child process to exit
		Process.waitall
		
This style of pipe server is in use in [tconsole](http://github.com/commondream/tconsole) and has worked amazingly well. It's faster than DRb for communication between forked processes, and has shown itself to be less error prone.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chattyproc-1.0.0 README.md