summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozprocess/tests/scripts/infinite_loop.py
blob: 9af60b381175338ae5bd4b3e835a92ec5b17358c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import signal
import sys
import threading
import time

if "deadlock" in sys.argv:
    lock = threading.Lock()

    def trap(sig, frame):
        lock.acquire()

    # get the lock once
    lock.acquire()
    # and take it again on SIGTERM signal: deadlock.
    signal.signal(signal.SIGTERM, trap)

while 1:
    time.sleep(1)