Repolode
ruby-concurrency

ruby-concurrency/concurrent-ruby

A Ruby gem offering concurrency primitives such as futures, promises, thread pools, agents, atoms, thread-safe collections and synchronization classes.

Stars
5,836
Forks
423
Open issues
53
Last commit
8 days ago

What is it?

Concurrent Ruby is a gem that provides a broad set of concurrency abstractions for Ruby applications. It includes asynchronous tools such as Promises (a unified futures and promises framework), ScheduledTask and TimerTask, along with Java-inspired thread pools and other executors.

The library also offers thread-safe value objects and collections, including thread-safe subclasses of Array, Hash and Set, a high-concurrency Map, immutable and mutable structs, and atomic types like AtomicReference and AtomicFixnum. For shared state it provides Clojure-style Agent and Atom, plus TVar for software transactional memory and synchronization classes such as CountDownLatch, Semaphore and ReadWriteLock.

The gem is designed to have no external gem dependencies and runs on MRI, JRuby and TruffleRuby. Optional C extensions for MRI are available in a separate concurrent-ruby-ext gem, and experimental features such as Actor and Channel live in the concurrent-ruby-edge companion gem.

Key features

  • 01Promises framework combining futures, promises, and delayed evaluation.
  • 02Thread pools and other executors inspired by Java's concurrent package.
  • 03Thread-safe Array, Hash, Set, and Map collections.
  • 04Atomic references, counters, and booleans for lock-free updates.
  • 05Agent and Atom for managing shared state, plus TVar for transactional memory.
  • 06Synchronization primitives including CountDownLatch, Semaphore, and ReadWriteLock.

Use cases

  • Running background jobs or parallel I/O tasks in a Ruby service without adding external dependencies.
  • Coordinating multiple threads with latches, barriers, or semaphores.
  • Scheduling periodic or delayed work inside a Ruby process.
  • Sharing mutable state safely across threads using atoms or thread-safe collections.

Things to know

  • The license could not be detected from the metadata, so check the repository's license file before use.
  • Features in the concurrent-ruby-edge companion gem may change frequently and break backward compatibility.

Topics

FAQ

What is concurrent-ruby?
A Ruby gem offering concurrency primitives such as futures, promises, thread pools, agents, atoms, thread-safe collections and synchronization classes. Concurrent Ruby is a gem that provides a broad set of concurrency abstractions for Ruby applications. It includes asynchronous tools such as Promises (a unified futures and promises framework), ScheduledTask and TimerTask, along with Java-inspired thread pools and other executors.
Is concurrent-ruby free to use? What license does it have?
concurrent-ruby is open source under the Other license. Check the license terms before using it in commercial products.
Is concurrent-ruby still maintained?
Actively maintained. The last commit to concurrent-ruby was on Oct 16, 2026.
What can I use concurrent-ruby for?
Running background jobs or parallel I/O tasks in a Ruby service without adding external dependencies. Coordinating multiple threads with latches, barriers, or semaphores. Scheduling periodic or delayed work inside a Ruby process. Sharing mutable state safely across threads using atoms or thread-safe collections.
Where can I get concurrent-ruby?
The source code and installation instructions are on GitHub: https://github.com/ruby-concurrency/concurrent-ruby

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects