# HG changeset patch
# User Oleg Oshmyan <chortos@inbox.lv>
# Date 1313080414 -10800
# Node ID 4f69e30abbd549501b6a21997fbc962ca00009a4
# Parent  3ab18984e3e32b200e5a007871ca45e00369a60a
Made sure the wakeup FD is always valid

diff -r 3ab18984e3e3 -r 4f69e30abbd5 upreckon/_unixmodule.cpp
--- a/upreckon/_unixmodule.cpp	Thu Jul 28 20:27:22 2011 +0300
+++ b/upreckon/_unixmodule.cpp	Thu Aug 11 19:33:34 2011 +0300
@@ -1295,6 +1295,7 @@
 	close(intpipe[0]);
 	close(intpipe[1]);
 	intpipe[0] = intpipe[1] = 0;
+	PySignal_SetWakeupFd(-1);
 }
 #endif
 
@@ -1404,8 +1405,6 @@
 		}
 #endif
 	}
-	
-	PySignal_SetWakeupFd(intpipe[1]);
 #endif
 	
 #if PY_MAJOR_VERSION >= 3
@@ -1450,6 +1449,10 @@
 	Py_AtExit(close_intpipe);
 #endif
 	
+#ifdef USE_WAKEUP_FD
+	PySignal_SetWakeupFd(intpipe[1]);
+#endif
+	
 #if PY_MAJOR_VERSION >= 3
 	return module;
 #endif