Skip to content

hugoabonizio/timeout.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timeout.cr Build Status

Declarative timeout pattern for Crystal using select keyword.

Installation

Add this to your application's shard.yml:

dependencies:
  timeout:
    github: hugoabonizio/timeout.cr

Usage

require "timeout"

ch = Channel(Int32).new

spawn do
  sleep 2
  ch.send 1
end

select
when value = ch.receive
  puts "Done!"
when Timeout.after(1.second)
  puts "Timeout!"
end

Contributing

  1. Fork it ( https://github.com/hugoabonizio/timeout.cr/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

About

⏳ Declarative timeout pattern for Crystal

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published