Created
August 2, 2016 08:44
-
-
Save bibstha/d24acbd892a892fd24ba5dc1a9aca4a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'concurrent-ruby-edge', require: 'concurrent-edge' | |
gem 'concurrent-ruby-ext' | |
end | |
require 'concurrent/channel' | |
x = Concurrent::Channel.new | |
Concurrent::Channel.go do | |
x << 1 | |
x << 2 | |
end | |
Concurrent::Channel.go do | |
puts ~x | |
# CPU Usage is 100% at this moment | |
sleep(10) | |
puts ~x | |
# CPU Usage goes down to normal | |
end | |
sleep(50) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment