From f334300ec0ba756ab8db19198cf769c9bdd4dc0d 2013-04-24 23:34:06
From: Siyu Zhang <siyuz@example.com>
Date: 2013-04-24 23:34:06
Subject: [PATCH] Changed sleep in signal thread to .01 sec. Moved imports to top.

---

diff --git a/IPython/lib/inputhookqt4.py b/IPython/lib/inputhookqt4.py
index 60f6252..8ab7f27 100644
--- a/IPython/lib/inputhookqt4.py
+++ b/IPython/lib/inputhookqt4.py
@@ -16,6 +16,11 @@ Author: Christian Boos
 # Imports
 #-----------------------------------------------------------------------------
 
+import os
+import signal
+import time
+import threading
+
 from IPython.core.interactiveshell import InteractiveShell
 from IPython.external.qt_for_kernel import QtCore, QtGui
 from IPython.lib.inputhook import allow_CTRL_C, ignore_CTRL_C, stdin_ready
@@ -117,13 +122,12 @@ def create_inputhook_qt4(mgr, app=None):
             ignore_CTRL_C()
             got_kbdint[0] = True
             mgr.clear_inputhook()
-            import os, signal, time, threading
             if(os.name == 'posix'):
                 pid = os.getpid()
                 print("^C")
                 thread = threading.Thread(
                             target = lambda:
-                                ( time.sleep(.1),
+                                ( time.sleep(.01),
                                   os.kill(pid, signal.SIGINT) )
                         )