Skip to content

Instantly share code, notes, and snippets.

@dmexe
Created February 14, 2014 11:47
Show Gist options
  • Save dmexe/8999774 to your computer and use it in GitHub Desktop.
Save dmexe/8999774 to your computer and use it in GitHub Desktop.
require 'thread'
m = Mutex.new
c = ConditionVariable.new
th = Thread.new do
include Vx::Common::Spawn
spawn "command" do |output|
if output =~ /regexp/
m.synchronize { c.signal }
end
end
end
m.synchronize do
c.wait(m)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment