Skip to content

Commit

Permalink
Add signal.siginterrupt to restart interrupted system calls
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed Jun 30, 2014
1 parent 5245e52 commit fc7fe46
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyinstrument/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def start(self):
if self.use_signal:
try:
signal.signal(signal.SIGALRM, self._signal)
# the following tells the system to restart interrupted system calls if they are
# interrupted before any data has been transferred. This avoids many of the problems
# related to signals interrupting system calls, see issue #16
signal.siginterrupt(signal.SIGALRM, False)
except ValueError:
raise NotMainThreadError()

Expand Down

0 comments on commit fc7fe46

Please sign in to comment.