Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and
Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and
-devs%20%26%20users-brightgreen.svg)
Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns.
The design goals of this gem are:
This gem depends on
contributions and we
appreciate your help. Would you like to contribute? Great! Have a look at
issues with looking-for-contributor label. And if you pick something up let us know on the issue.
You can also get started by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to subscribe to concurrent-ruby on CodeTriage.
Concurrent Ruby makes one of the strongest thread safety guarantees of any Ruby concurrency library, providing consistent behavior and guarantees on all three main Ruby interpreters (MRI/CRuby, JRuby, TruffleRuby).
Every abstraction in this library is thread safe. Specific thread safety guarantees are documented with each abstraction.
It is critical to remember, however, that Ruby is a language of mutable references. No concurrency library for Ruby can ever prevent the user from making thread safety mistakes (such as sharing a mutable object between threads and modifying it on both threads) or from creating deadlocks through incorrect use of locks. All the library can do is provide safe abstractions which encourage safe practices. Concurrent Ruby provides more safe concurrency abstractions than any other Ruby library, many of which support the mantra of "Do not communicate by sharing memory; instead, share memory by communicating". Concurrent Ruby is also the only Ruby library which provides a full suite of thread safe and immutable variable types and data structures.
We've also initiated discussion to document the memory model of Ruby which would provide consistent behaviour and guarantees on all three main Ruby interpreters (MRI/CRuby, JRuby, TruffleRuby).
The primary site for documentation is the automatically generated API documentation which is up to date with latest release. This readme matches the master so may contain new stuff not yet released.
We also have a IRC (gitter).
concurrent-ruby uses Semantic Versioningconcurrent-ruby-ext has always same version as concurrent-rubyconcurrent-ruby-edge will always be 0.y.z therefore following
point 4 applies "Major version zero
(0.y.z) is for initial development. Anything may change at any time. The
public API should not be considered stable." However we additionally use
following rules:Future,
Promise, IVar, Event, dataflow, Delay, and (partially) TimerTask into a single
framework. It extensively uses the new synchronization layer to make all the features
non-blocking and lock-free, with the exception of obviously blocking operations like
#wait, #value. It also offers better performance.Collection classes that were originally part of the (deprecated) thread_safe gem:
Concurrent::Hash.Value objects inspired by other languages:
Structure classes derived from Ruby's Struct:
Thread-safe variables:
Deprecated features are still available and bugs are being fixed, but new features will not be added.
No open issues yet, or sync has not completed.