Skip to content

Instantly share code, notes, and snippets.

Created October 24, 2012 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3948056 to your computer and use it in GitHub Desktop.
Save anonymous/3948056 to your computer and use it in GitHub Desktop.
def newT
t = Thread.new do
Thread.current[:running] = true
while Thread.current[:running]
sleep 5
puts "running"
end
puts "thread exiting"
end
return t
end
t = newT
sleep(10)
t[:running] = false
t.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment