Debian Codegraph @

testing/mozbase/mozprocess/tests/scripts/infinite_loop.py

raw
1 import signal
2 import sys
3 import threading
4 import time
5
6 if "deadlock" in sys.argv:
7 lock = threading.Lock()
8
9 def trap(sig, frame):
10 lock.acquire()
11
12 # get the lock once
13 lock.acquire()
14 # and take it again on SIGTERM signal: deadlock.
15 signal.signal(signal.SIGTERM, trap)
16
17 while 1:
18 time.sleep(1)