Skip to content

Instantly share code, notes, and snippets.

@glebtv
Created December 5, 2013 13:05
Show Gist options
  • Save glebtv/7804846 to your computer and use it in GitHub Desktop.
Save glebtv/7804846 to your computer and use it in GitHub Desktop.
def thread_state(thr)
vars = Hash[thr.thread_variables.map do |k|
[k, thr.thread_variable_get(k)]
end]
{
status: thr.status,
stop: thr.stop?,
alive: thr.alive?,
aoe: thr.abort_on_exception,
backtrace: thr.backtrace,
inspect: thr.inspect,
priority: thr.priority,
vars: vars
}
end
Thread.list.map { |thr|
thread_state('thread', thr)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment