Skip to content

Commit

Permalink
Force start of signal queues for Windows; protect access of limbo loc…
Browse files Browse the repository at this point in the history
…k with a try-except.
  • Loading branch information
emeryberger committed Jul 11, 2021
1 parent 5b0ab50 commit 9066cf9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scalene/scalene_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ def enable_signals() -> None:
Scalene.timer_signals = True
t = threading.Thread(target=Scalene.timer_thang)
t.start()
Scalene.start_signal_queues()
return
Scalene.start_signal_queues()
# Set signal handlers for memory allocation and memcpy events.
Expand Down Expand Up @@ -703,11 +704,14 @@ def compute_frames_to_record(
this_frame: FrameType,
) -> List[Tuple[FrameType, int, FrameType]]:
"""Collects all stack frames that Scalene actually processes."""
if threading._active_limbo_lock.locked(): # type: ignore
# Avoids deadlock where a Scalene signal occurs
# in the middle of a critical section of the
# threading library
return []
try:
if threading._active_limbo_lock.locked(): # type: ignore
# Avoids deadlock where a Scalene signal occurs
# in the middle of a critical section of the
# threading library
return []
except:
pass
frames: List[Tuple[FrameType, int]] = [
(
cast(
Expand Down

0 comments on commit 9066cf9

Please sign in to comment.