mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-18 10:23:08 +09:00
18 lines
325 B
Python
18 lines
325 B
Python
|
|
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)
|