Skip to content

Commit

Permalink
Provide defaults for timers.
Browse files Browse the repository at this point in the history
Windows - threading
Signal - all other
  • Loading branch information
Šarūnas Navickas committed Jun 4, 2016
1 parent 688c63f commit 3860fcb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions robust/alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ def reset():
return reset


def alarm_create(timeout, callback):
return _signal_timer(timeout, callback)
def alarm_create(timeout, callback, use_signal=True):
import platform
if use_signal and platform.system() != "Windows": # SIGALRM does not work on Windows
return _signal_timer(timeout, callback)
else:
return _threading_timer(timeout, callback)


@contextmanager
Expand Down

0 comments on commit 3860fcb

Please sign in to comment.