Skip to content

Instantly share code, notes, and snippets.

@jjb
Created September 16, 2012 00:43
Show Gist options
  • Save jjb/3730588 to your computer and use it in GitHub Desktop.
Save jjb/3730588 to your computer and use it in GitHub Desktop.
raising an exception inside a child thread
def do_jobs
begin
while true
# do interesting things
end
rescue NoMoreDiskSpace
# tidy things up
end
end
t = Thread.new(do_jobs)
while true
if disk_is_full
t.raise(NoMoreDiskSpace)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment