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

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)