herd
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
- Fork it ( https://github.com/molovo/cluster/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- molovo James Dinsdale - creator, maintainer
Repository
herd
Owner
Statistic
- 7
- 0
- 0
- 1
- 0
- over 7 years ago
- May 21, 2017
License
MIT License
Links
Synced at
Fri, 22 Nov 2024 00:38:11 GMT
Languages