Skip to content

Instantly share code, notes, and snippets.

@bibstha
Created August 2, 2016 08:44
Show Gist options
  • Save bibstha/d24acbd892a892fd24ba5dc1a9aca4a2 to your computer and use it in GitHub Desktop.
Save bibstha/d24acbd892a892fd24ba5dc1a9aca4a2 to your computer and use it in GitHub Desktop.
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