Skip to content

molovo/herd

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

Herd

A simple module to help with running multi-threaded processes in Crystal

Installation

Add this to your application's shard.yml:

dependencies:
  herd:
    github: molovo/herd

Usage

require "herd"
require "http/server"

# Create a new cluster with 4 threads
cluster = Herd::Cluster.new 4

# Specify the process to run
cluster.execute do
  server = HTTP::Server.new(8080) do |context|
    context.response.print "Hello World!"
  end
  puts "Thread #{Herd::Cluster.thread} listening on http://127.0.0.1:8080"
  server.listen true
end

Contributing

  1. Fork it ( https://github.com/molovo/cluster/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • molovo James Dinsdale - creator, maintainer

About

A simple module to help with running multi-threaded processes in Crystal

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published