Skip to content

Instantly share code, notes, and snippets.

@cjhanks
Created October 22, 2013 22:16
Show Gist options
  • Select an option

  • Save cjhanks/7109153 to your computer and use it in GitHub Desktop.

Select an option

Save cjhanks/7109153 to your computer and use it in GitHub Desktop.
sigusr1
from signal import signal, SIGUSR1
from traceback import format_stack
from sys import stderr
def dump_frame(sig, frame):
if sig is SIGUSR1:
stderr.write(''.join(format_stack(frame)))
def t1():
from time import sleep
while True:
sleep(3)
def t0():
return t1()
signal(SIGUSR1, dump_frame)
t0()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment