Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 271b27e

Browse files
author
Victor Stinner
committed
Issue #11768: add debug messages in test_threadsignals.test_signals
1 parent fe7c5b5 commit 271b27e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_threadsignals.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ def handle_signals(sig,frame):
3030

3131
# a function that will be spawned as a separate thread.
3232
def send_signals():
33+
print("send_signals: enter (thread %s)" % thread.get_ident(), file=sys.stderr)
34+
print("send_signals: raise SIGUSR1", file=sys.stderr)
3335
os.kill(process_pid, signal.SIGUSR1)
36+
print("send_signals: raise SIGUSR2", file=sys.stderr)
3437
os.kill(process_pid, signal.SIGUSR2)
38+
print("send_signals: release signalled_all", file=sys.stderr)
3539
signalled_all.release()
40+
print("send_signals: exit (thread %s)" % thread.get_ident(), file=sys.stderr)
3641

3742
class ThreadSignals(unittest.TestCase):
3843

@@ -41,9 +46,12 @@ def test_signals(self):
4146
# We spawn a thread, have the thread send two signals, and
4247
# wait for it to finish. Check that we got both signals
4348
# and that they were run by the main thread.
49+
print("test_signals: acquire lock (thread %s)" % thread.get_ident(), file=sys.stderr)
4450
signalled_all.acquire()
4551
self.spawnSignallingThread()
52+
print("test_signals: wait lock (thread %s)" % thread.get_ident(), file=sys.stderr)
4653
signalled_all.acquire()
54+
print("test_signals: lock acquired", file=sys.stderr)
4755
# the signals that we asked the kernel to send
4856
# will come back, but we don't know when.
4957
# (it might even be after the thread exits

0 commit comments

Comments
 (0)