Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dasch/ruby-csp

Ruby implementation of Communicating Sequential Processes
https://github.com/dasch/ruby-csp

Last synced: about 19 hours ago
JSON representation

Ruby implementation of Communicating Sequential Processes

Awesome Lists containing this project

README

        

Concurrent Sequential Processes
===============================

This library provides a concurrency framework based on the work of Tony Hoare
in his book ["Communicating Sequential Processes"](http://www.usingcsp.com/).

Usage
-----

With CSP, your problem is modelled by *processes* that run concurrently, but
are sequential internally. These processes communicate over *channels*, which
provide a simple messaging API.

# Prints "Hello, World!" to stdout.
chan = CSP::Channel.new
CSP::Process.start { puts(chan.read) }
CSP::Process.start { chan << "Hello, World!" }

Note that the process is blocked when trying to read on the channel, and only
resumes execution when it is able to read a value.