{"id":13462953,"url":"https://github.com/ruby-concurrency/concurrent-ruby","last_synced_at":"2025-09-09T21:10:59.906Z","repository":{"id":9666903,"uuid":"11607598","full_name":"ruby-concurrency/concurrent-ruby","owner":"ruby-concurrency","description":"Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.","archived":false,"fork":false,"pushed_at":"2025-08-26T19:53:52.000Z","size":11083,"stargazers_count":5765,"open_issues_count":59,"forks_count":419,"subscribers_count":117,"default_branch":"master","last_synced_at":"2025-09-04T22:38:21.075Z","etag":null,"topics":["concurrency","ruby"],"latest_commit_sha":null,"homepage":"https://ruby-concurrency.github.io/concurrent-ruby/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby-concurrency.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/generate_docs.rb","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-07-23T12:19:51.000Z","updated_at":"2025-09-04T18:53:08.000Z","dependencies_parsed_at":"2023-02-15T11:45:58.589Z","dependency_job_id":"396cd408-4b8a-4606-a7d5-d6a1ed403bb2","html_url":"https://github.com/ruby-concurrency/concurrent-ruby","commit_stats":{"total_commits":2602,"total_committers":166,"mean_commits":"15.674698795180722","dds":0.5876249039200615,"last_synced_commit":"957cf7d09aae59db7026e607ca42768aad644ebc"},"previous_names":["jdantonio/concurrent-ruby"],"tags_count":97,"template":false,"template_full_name":null,"purl":"pkg:github/ruby-concurrency/concurrent-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-concurrency%2Fconcurrent-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-concurrency%2Fconcurrent-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-concurrency%2Fconcurrent-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-concurrency%2Fconcurrent-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby-concurrency","download_url":"https://codeload.github.com/ruby-concurrency/concurrent-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-concurrency%2Fconcurrent-ruby/sbom","scorecard":{"id":641179,"data":{"date":"2025-08-11","repo":{"name":"github.com/ruby-concurrency/concurrent-ruby","commit":"52f0ee417e28210d8848dd532ed332744791538c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Maintained","score":0,"reason":"1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/docs.yml:8","Warn: no topLevel permission defined: .github/workflows/experimental.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":4,"reason":"Found 12/27 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:64: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/docs.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/docs.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/docs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/docs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/docs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/experimental.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/experimental.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/experimental.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby-concurrency/concurrent-ruby/experimental.yml/master?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T10:48:36.744Z","repository_id":9666903,"created_at":"2025-08-21T10:48:36.745Z","updated_at":"2025-08-21T10:48:36.745Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273792310,"owners_count":25169091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrency","ruby"],"created_at":"2024-07-31T13:00:42.128Z","updated_at":"2025-09-09T21:10:59.850Z","avatar_url":"https://github.com/ruby-concurrency.png","language":"Ruby","readme":"# Concurrent Ruby\n\n[![Gem Version](https://badge.fury.io/rb/concurrent-ruby.svg)](http://badge.fury.io/rb/concurrent-ruby)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)\n[![Gitter chat](https://img.shields.io/badge/IRC%20(gitter)-devs%20%26%20users-brightgreen.svg)](https://gitter.im/ruby-concurrency/concurrent-ruby)\n\nModern concurrency tools for Ruby. Inspired by\n[Erlang](http://www.erlang.org/doc/reference_manual/processes.html),\n[Clojure](http://clojure.org/concurrent_programming),\n[Scala](http://akka.io/),\n[Haskell](http://www.haskell.org/haskellwiki/Applications_and_libraries/Concurrency_and_parallelism#Concurrent_Haskell),\n[F#](http://blogs.msdn.com/b/dsyme/archive/2010/02/15/async-and-parallel-design-patterns-in-f-part-3-agents.aspx),\n[C#](http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx),\n[Java](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/package-summary.html),\nand classic concurrency patterns.\n\n\u003cimg src=\"https://raw.githubusercontent.com/ruby-concurrency/concurrent-ruby/master/docs-source/logo/concurrent-ruby-logo-300x300.png\" align=\"right\" style=\"margin-left: 20px;\" /\u003e\n\nThe design goals of this gem are:\n\n*   Be an 'unopinionated' toolbox that provides useful utilities without debating which is better \n    or why\n*   Remain free of external gem dependencies\n*   Stay true to the spirit of the languages providing inspiration\n*   But implement in a way that makes sense for Ruby\n*   Keep the semantics as idiomatic Ruby as possible\n*   Support features that make sense in Ruby\n*   Exclude features that don't make sense in Ruby\n*   Be small, lean, and loosely coupled\n*   Thread-safety\n*   Backward compatibility\n\n## Contributing\n\n**This gem depends on \n[contributions](https://github.com/ruby-concurrency/concurrent-ruby/graphs/contributors) and we \nappreciate your help. Would you like to contribute? Great! Have a look at \n[issues with `looking-for-contributor` label](https://github.com/ruby-concurrency/concurrent-ruby/issues?q=is%3Aissue+is%3Aopen+label%3Alooking-for-contributor).** And if you pick something up let us know on the issue.\n\nYou 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](https://www.codetriage.com/ruby-concurrency/concurrent-ruby). [![Open Source Helpers](https://www.codetriage.com/ruby-concurrency/concurrent-ruby/badges/users.svg)](https://www.codetriage.com/ruby-concurrency/concurrent-ruby)\n\n## Thread Safety\n\n*Concurrent Ruby makes one of the strongest thread safety guarantees of any Ruby concurrency \nlibrary, providing consistent behavior and guarantees on all three main Ruby interpreters\n(MRI/CRuby, JRuby, TruffleRuby).*\n\nEvery abstraction in this library is thread safe. Specific thread safety guarantees are documented \nwith each abstraction.\n\nIt is critical to remember, however, that Ruby is a language of mutable references. *No*\nconcurrency library for Ruby can ever prevent the user from making thread safety mistakes (such as\nsharing a mutable object between threads and modifying it on both threads) or from creating\ndeadlocks through incorrect use of locks. All the library can do is provide safe abstractions which\nencourage safe practices. Concurrent Ruby provides more safe concurrency abstractions than any\nother Ruby library, many of which support the mantra of \n[\"Do not communicate by sharing memory; instead, share memory by communicating\"](https://blog.golang.org/share-memory-by-communicating).\nConcurrent Ruby is also the only Ruby library which provides a full suite of thread safe and\nimmutable variable types and data structures.\n\nWe've also initiated discussion to document the [memory model](docs-source/synchronization.md) of Ruby which \nwould provide consistent behaviour and guarantees on all three main Ruby interpreters \n(MRI/CRuby, JRuby, TruffleRuby).\n\n## Features \u0026 Documentation\n\n**The primary site for documentation is the automatically generated \n[API documentation](http://ruby-concurrency.github.io/concurrent-ruby/index.html) which is up to \ndate with latest release.** This readme matches the master so may contain new stuff not yet \nreleased.\n\nWe also have a [IRC (gitter)](https://gitter.im/ruby-concurrency/concurrent-ruby).\n\n### Versioning\n\n*   `concurrent-ruby` uses [Semantic Versioning](http://semver.org/)\n*   `concurrent-ruby-ext` has always same version as `concurrent-ruby`\n*   `concurrent-ruby-edge` will always be 0.y.z therefore following \n    [point 4](http://semver.org/#spec-item-4) applies *\"Major version zero \n    (0.y.z) is for initial development. Anything may change at any time. The \n    public API should not be considered stable.\"* However we additionally use \n    following rules:\n    *   Minor version increment means incompatible changes were made\n    *   Patch version increment means only compatible changes were made\n\n\n#### General-purpose Concurrency Abstractions\n\n*   [Async](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Async.html):\n    A mixin module that provides simple asynchronous behavior to a class. Loosely based on Erlang's \n    [gen_server](http://www.erlang.org/doc/man/gen_server.html).\n*   [ScheduledTask](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ScheduledTask.html):\n    Like a Future scheduled for a specific future time.\n*   [TimerTask](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/TimerTask.html):\n    A Thread that periodically wakes up to perform work at regular intervals.\n*   [Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html):\n    Unified implementation of futures and promises which combines features of previous `Future`,\n    `Promise`, `IVar`, `Event`, `dataflow`, `Delay`, and (partially) `TimerTask` into a single \n    framework. It extensively uses the new synchronization layer to make all the features \n    **non-blocking** and **lock-free**, with the exception of obviously blocking operations like \n    `#wait`, `#value`. It also offers better performance.    \n\n#### Thread-safe Value Objects, Structures, and Collections\n\nCollection classes that were originally part of the (deprecated) `thread_safe` gem:\n\n*   [Array](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Array.html) A thread-safe\n    subclass of Ruby's standard [Array](http://ruby-doc.org/core/Array.html).\n*   [Hash](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Hash.html) A thread-safe\n    subclass of Ruby's standard [Hash](http://ruby-doc.org/core/Hash.html).\n*   [Set](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Set.html) A thread-safe\n    subclass of Ruby's standard [Set](http://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html).\n*   [Map](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Map.html) A hash-like object\n    that should have much better performance characteristics, especially under high concurrency, \n    than `Concurrent::Hash`.\n*   [Tuple](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Tuple.html) A fixed size\n    array with volatile (synchronized, thread safe) getters/setters.\n\nValue objects inspired by other languages:\n\n*   [Maybe](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Maybe.html) A thread-safe,\n    immutable object representing an optional value, based on \n    [Haskell Data.Maybe](https://hackage.haskell.org/package/base-4.2.0.1/docs/Data-Maybe.html).\n\nStructure classes derived from Ruby's [Struct](http://ruby-doc.org/core/Struct.html):\n\n*   [ImmutableStruct](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ImmutableStruct.html)\n    Immutable struct where values are set at construction and cannot be changed later.\n*   [MutableStruct](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/MutableStruct.html)\n    Synchronized, mutable struct where values can be safely changed at any time.\n*   [SettableStruct](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/SettableStruct.html)\n    Synchronized, write-once struct where values can be set at most once, either at construction \n    or any time thereafter.\n\nThread-safe variables:\n\n*   [Agent](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Agent.html): A way to\n    manage shared, mutable, *asynchronous*, independent state. Based on Clojure's \n    [Agent](http://clojure.org/agents).\n*   [Atom](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Atom.html): A way to manage\n    shared, mutable, *synchronous*, independent state. Based on Clojure's \n    [Atom](http://clojure.org/atoms).\n*   [AtomicBoolean](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicBoolean.html)\n    A boolean value that can be updated atomically.\n*   [AtomicFixnum](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicFixnum.html)\n    A numeric value that can be updated atomically.\n*   [AtomicReference](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicReference.html)\n    An object reference that may be updated atomically.\n*   [Exchanger](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Exchanger.html)\n    A synchronization point at which threads can pair and swap elements within pairs. Based on \n    Java's [Exchanger](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Exchanger.html).\n*   [MVar](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/MVar.html) A synchronized\n    single element container. Based on Haskell's \n    [MVar](https://hackage.haskell.org/package/base-4.8.1.0/docs/Control-Concurrent-MVar.html) and \n    Scala's [MVar](http://docs.typelevel.org/api/scalaz/nightly/index.html#scalaz.concurrent.MVar$).\n*   [ThreadLocalVar](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ThreadLocalVar.html)\n    A variable where the value is different for each thread.\n*   [TVar](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/TVar.html) A transactional\n    variable implementing software transactional memory (STM). Based on Clojure's \n    [Ref](http://clojure.org/refs).\n\n#### Java-inspired ThreadPools and Other Executors\n\n*   See the [thread pool](http://ruby-concurrency.github.io/concurrent-ruby/master/file.thread_pools.html)\n    overview, which also contains a list of other Executors available.\n\n#### Thread Synchronization Classes and Algorithms\n\n*   [CountDownLatch](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/CountDownLatch.html)\n    A synchronization object that allows one thread to wait on multiple other threads.\n*   [CyclicBarrier](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/CyclicBarrier.html)\n    A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point.\n*   [Event](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Event.html) Old school\n    kernel-style event.\n*   [ReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ReadWriteLock.html)\n    A lock that supports multiple readers but only one writer.\n*   [ReentrantReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ReentrantReadWriteLock.html)\n    A read/write lock with reentrant and upgrade features.\n*   [Semaphore](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Semaphore.html)\n    A counting-based locking mechanism that uses permits.\n*   [AtomicMarkableReference](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicMarkableReference.html)\n\n#### Deprecated\n\nDeprecated features are still available and bugs are being fixed, but new features will not be added.\n  \n*   ~~[Future](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Future.html):\n    An asynchronous operation that produces a value.~~ Replaced by \n    [Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).\n    *   ~~[.dataflow](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent.html#dataflow-class_method):\n        Built on Futures, Dataflow allows you to create a task that will be scheduled when all of \n        its data dependencies are available.~~ Replaced by \n        [Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).\n*   ~~[Promise](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promise.html): Similar\n    to Futures, with more features.~~ Replaced by \n    [Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).\n*   ~~[Delay](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Delay.html) Lazy evaluation\n    of a block yielding an immutable result. Based on Clojure's \n    [delay](https://clojuredocs.org/clojure.core/delay).~~ Replaced by \n    [Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).\n*   ~~[IVar](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/IVar.html) Similar to a\n    \"future\" but can be manually assigned once, after which it becomes immutable.~~ Replaced by \n    [Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).\n    \n### Edge Features\n\nThese are available in the `concurrent-ruby-edge` companion gem.\n\nThese features are under active development and may change frequently. They are expected not to\nkeep backward compatibility (they may also lack tests and documentation). Semantic versions will\nbe obeyed though. Features developed in `concurrent-ruby-edge` are expected to move to\n`concurrent-ruby` when final.\n\n*   [Actor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Actor.html): Implements\n    the Actor Model, where concurrent actors exchange messages.\n    *Status: Partial documentation and tests; depends on new future/promise framework; stability is good.*\n*   [Channel](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Channel.html):\n    Communicating Sequential Processes ([CSP](https://en.wikipedia.org/wiki/Communicating_sequential_processes)).\n    Functionally equivalent to Go [channels](https://tour.golang.org/concurrency/2) with additional\n    inspiration from Clojure [core.async](https://clojure.github.io/core.async/).\n    *Status: Partial documentation and tests.*\n*   [LazyRegister](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/LazyRegister.html)\n*   [LockFreeLinkedSet](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Edge/LockFreeLinkedSet.html)\n    *Status: will be moved to core soon.*\n*   [LockFreeStack](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/LockFreeStack.html)\n    *Status: missing documentation and tests.*\n*   [Promises::Channel](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises/Channel.html)\n    A first in first out channel that accepts messages with push family of methods and returns\n    messages with pop family of methods.\n    Pop and push operations can be represented as futures, see `#pop_op` and `#push_op`.\n    The capacity of the channel can be limited to support back pressure, use capacity option in `#initialize`.\n    `#pop` method blocks ans `#pop_op` returns pending future if there is no message in the channel.\n    If the capacity is limited the `#push` method blocks and `#push_op` returns pending future.\n*   [Cancellation](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Cancellation.html)\n    The Cancellation abstraction provides cooperative cancellation.\n\n    The standard methods `Thread#raise` of `Thread#kill` available in Ruby\n    are very dangerous (see linked the blog posts bellow).\n    Therefore concurrent-ruby provides an alternative.\n    \n    *   \u003chttps://jvns.ca/blog/2015/11/27/why-rubys-timeout-is-dangerous-and-thread-dot-raise-is-terrifying/\u003e\n    *   \u003chttp://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/\u003e\n    *   \u003chttp://blog.headius.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html\u003e\n\n    It provides an object which represents a task which can be executed,\n    the task has to get the reference to the object and periodically cooperatively check that it is not cancelled.\n    Good practices to make tasks cancellable:\n    *   check cancellation every cycle of a loop which does significant work,\n    *   do all blocking actions in a loop with a timeout then on timeout check cancellation\n        and if ok block again with the timeout \n*   [Throttle](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Throttle.html)\n    A tool managing concurrency level of tasks.\n*   [ErlangActor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ErlangActor.html)\n    Actor implementation which precisely matches Erlang actor behaviour. \n    Requires at least Ruby 2.1 otherwise it's not loaded.\n*   [WrappingExecutor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/WrappingExecutor.html) \n    A delegating executor which modifies each task before the task is given to \n    the target executor it delegates to.\n\n## Supported Ruby versions\n\n* MRI 2.3 and above\n* Latest JRuby 9000\n* Latest TruffleRuby\n\n## Usage\n\nEverything within this gem can be loaded simply by requiring it:\n\n```ruby\nrequire 'concurrent'\n```\n\nYou can also require a specific abstraction [part of the public documentation](https://ruby-concurrency.github.io/concurrent-ruby/master/index.html) since concurrent-ruby 1.2.0, for example:\n```ruby\nrequire 'concurrent/map'\nrequire 'concurrent/atomic/atomic_reference'\nrequire 'concurrent/executor/fixed_thread_pool'\n```\n\nTo use the tools in the Edge gem it must be required separately:\n\n```ruby\nrequire 'concurrent-edge'\n```\n\nIf the library does not behave as expected, `Concurrent.use_simple_logger(:DEBUG)` could\nhelp to reveal the problem.\n\n## Installation\n\n```shell\ngem install concurrent-ruby\n```\n\nor add the following line to Gemfile:\n\n```ruby\ngem 'concurrent-ruby', require: 'concurrent'\n```\n\nand run `bundle install` from your shell.\n\n### Edge Gem Installation\n\nThe Edge gem must be installed separately from the core gem:\n\n```shell\ngem install concurrent-ruby-edge\n```\n\nor add the following line to Gemfile:\n\n```ruby\ngem 'concurrent-ruby-edge', require: 'concurrent-edge'\n```\n\nand run `bundle install` from your shell.\n\n\n### C Extensions for MRI\n\nPotential performance improvements may be achieved under MRI by installing optional C extensions.\nTo minimise installation errors the C extensions are available in the `concurrent-ruby-ext`\nextension gem. `concurrent-ruby` and `concurrent-ruby-ext` are always released together with same\nversion. Simply install the extension gem too:\n\n```ruby\ngem install concurrent-ruby-ext\n```\n\nor add the following line to Gemfile:\n\n```ruby\ngem 'concurrent-ruby-ext'\n```\n\nand run `bundle install` from your shell.\n\nIn code it is only necessary to\n\n```ruby\nrequire 'concurrent'\n```\n\nThe `concurrent-ruby` gem will automatically detect the presence of the `concurrent-ruby-ext` gem\nand load the appropriate C extensions.\n\n#### Note For gem developers\n\nNo gems should depend on `concurrent-ruby-ext`. Doing so will force C extensions on your users. The\nbest practice is to depend on `concurrent-ruby` and let users to decide if they want C extensions.\n\n## Building the gem\n\n### Requirements\n\n* Recent CRuby\n* JRuby, `rbenv install jruby-9.2.17.0`\n* Set env variable `CONCURRENT_JRUBY_HOME` to point to it, e.g. `/usr/local/opt/rbenv/versions/jruby-9.2.17.0`\n* Install Docker or Podman, required for Windows builds\n* If `bundle config get path` is set, use `bundle config set --local path.system true` otherwise the `gem name, path: '.'` gems won't be found (Bundler limitation).\n\n### Publishing the Gem\n\n* Update `version.rb`\n* Update the CHANGELOG\n* Add the new version to `docs-source/signpost.md`. Needs to be done only if there are visible changes in the documentation.\n* Commit (and push) the changes.\n* Use `bundle exec rake release` to release the gem.\n  It consists of `['release:checks', 'release:build', 'release:test', 'release:publish']` steps.\n  It will ask at the end before publishing anything. Steps can also be executed individually.\n\n## Maintainers\n\n* [Benoit Daloze](https://github.com/eregon)\n* [Matthew Draper](https://github.com/matthewd)\n* [Rafael França](https://github.com/rafaelfranca)\n* [Charles Oliver Nutter](https://github.com/headius)\n* [Ben Sheldon](https://github.com/bensheldon)\n* [Samuel Williams](https://github.com/ioquatix)\n\n### Special Thanks to\n\n* [Jerry D'Antonio](https://github.com/jdantonio) for creating the gem\n* [Brian Durand](https://github.com/bdurand) for the `ref` gem\n* [Charles Oliver Nutter](https://github.com/headius) for the `atomic` and `thread_safe` gems\n* [thedarkone](https://github.com/thedarkone) for the `thread_safe` gem\n\nto the past maintainers\n\n* [Chris Seaton](https://github.com/chrisseaton)\n* [Petr Chalupa](https://github.com/pitr-ch)\n* [Michele Della Torre](https://github.com/mighe)\n* [Paweł Obrok](https://github.com/obrok)\n* [Lucas Allan](https://github.com/lucasallan)\n\nand to [Ruby Association](https://www.ruby.or.jp/en/) for sponsoring a project \n[\"Enhancing Ruby’s concurrency tooling\"](https://www.ruby.or.jp/en/news/20181106) in 2018. \n\n## License and Copyright\n\n*Concurrent Ruby* is free software released under the \n[MIT License](http://www.opensource.org/licenses/MIT).\n\nThe *Concurrent Ruby* [logo](https://raw.githubusercontent.com/ruby-concurrency/concurrent-ruby/master/docs-source/logo/concurrent-ruby-logo-300x300.png) was\ndesigned by [David Jones](https://twitter.com/zombyboy). It is Copyright \u0026copy; 2014 \n[Jerry D'Antonio](https://twitter.com/jerrydantonio). All Rights Reserved.\n","funding_links":[],"categories":["Background Processing","Ruby","Concurrency","Advanced Ruby and Rails","Concurrency and Parallelism","并发编程","Ruby Library Collections"],"sub_categories":["Background Jobs","Advanced Ruby"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby-concurrency%2Fconcurrent-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby-concurrency%2Fconcurrent-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby-concurrency%2Fconcurrent-ruby/lists"}