Skip to content

Instantly share code, notes, and snippets.

@eric-wood
Last active August 29, 2015 14:14
Show Gist options
  • Save eric-wood/6bfb4981297324a500eb to your computer and use it in GitHub Desktop.
Save eric-wood/6bfb4981297324a500eb to your computer and use it in GitHub Desktop.
fawefawef
require 'unimidi'
@input = UniMIDI::Input.use(:first)
Thread.new do
Thread.current[:notes] = []
loop do
puts "searching!"
note = @input.gets
p note
if is_key_on?(note)
Thread.current[:notes] << note
end
end
end
sleep(10)
require 'unimidi'
input = UniMIDI::Input.use(:first)
Thread.new do
Thread.current[:notes] = []
loop do
Thread.current[:notes] << input.gets
p Thread.current[:notes]
end
end
sleep(10)
@evanbleiweiss
Copy link

t = Thread.new { raise "oops" }
sleep 1 # give it plenty of time to fail
begin
  t.join
rescue => error
  puts "Child raised error: #{error.inspect}"
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment