From 337c2047adfe799b4f3063ace0cae54eef3be167 Mon Sep 17 00:00:00 2001 From: "R. Tyler Ballance" Date: Tue, 24 Aug 2010 13:00:23 -0700 Subject: [PATCH] Add support for using signal.setitimer or the itimer module for blocking detection The itimer module can be found here: http://github.com/slideinc/itimer for versions of Python prior to 2.6 --- eventlet/hubs/hub.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eventlet/hubs/hub.py b/eventlet/hubs/hub.py index 0f9d0cb..ebcabc5 100644 --- a/eventlet/hubs/hub.py +++ b/eventlet/hubs/hub.py @@ -4,10 +4,15 @@ import traceback import warnings import signal -HAS_ITIMER = False +alarm_func = signal.alarm + try: - import itimer - HAS_ITIMER = True + if hasattr(signal, 'setitimer'): + HAS_ITIMER = True + else: + import itimer + HAS_ITIMER = True + alarm_func = itimer.alarm except ImportError: pass