concurrent

Modern concurrency tools concurrent
0.1.1 released

concurrent.cr

Build Status Docs

Modern Adequate Any New opportunities for concurrency tools in Crystal.
Large empty lots spacious directories available to build your dream home algorithm!
Space is filling up at (24k code bytes / 2 months) 0.004 bytes per second. Register your PR today!
©️ Real estate marketing association

Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns which inspired Ruby, which inspired this library.

Available classes:

More algorithms are coming. Contributions welcome.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      concurrent:
        github: didactic-drunk/concurrent.cr
    
  2. Run shards install

Usage

CountDownLatch

require "concurrent/count_down_latch"

fiber_count = 10
latch = Concurrent::CountDownLatch.new
10.times do
  spawn do
    # Do work
    latch.count_down
  end
end

latch.wait_count = fiber_count
latch.wait

Semaphore

require "concurrent/semaphore"

sem = Concurrent::Semaphore.new n

# spawn a lot of fibers
2000.times do
  spawn do
    sem.acquire do
      ...
    end
  end
end

Development

TODO: Write development instructions here

Contributing

  1. Fork it (https://github.com/didactic-drunk/concurrent.cr/fork)
  2. Install a formatting check git hook (ln -sf ../../scripts/git/pre-commit .git/hooks)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Contributors

  • Click or Run git shortlog --summary --numbered --email
concurrent:
  github: didactic-drunk/concurrent.cr
  version: ~> 0.1.1
License MIT
Crystal 0.34.0

Dependencies 0

Development Dependencies 0

Dependents 0

Last synced .
search fire star recently