comparison upreckon/_unixmodule.cpp @ 191:4f69e30abbd5

Made sure the wakeup FD is always valid
author Oleg Oshmyan <chortos@inbox.lv>
date Thu, 11 Aug 2011 19:33:34 +0300
parents 3ab18984e3e3
children 8c4e92fb32d8
comparison
equal deleted inserted replaced
190:3ab18984e3e3 191:4f69e30abbd5
1293 static void close_intpipe(void) 1293 static void close_intpipe(void)
1294 { 1294 {
1295 close(intpipe[0]); 1295 close(intpipe[0]);
1296 close(intpipe[1]); 1296 close(intpipe[1]);
1297 intpipe[0] = intpipe[1] = 0; 1297 intpipe[0] = intpipe[1] = 0;
1298 PySignal_SetWakeupFd(-1);
1298 } 1299 }
1299 #endif 1300 #endif
1300 1301
1301 #ifdef HAVE_TERMIOS_H 1302 #ifdef HAVE_TERMIOS_H
1302 static void restore_termios(void) 1303 static void restore_termios(void)
1402 Py_DECREF(CannotStartTestee); 1403 Py_DECREF(CannotStartTestee);
1403 INIT_FAIL; 1404 INIT_FAIL;
1404 } 1405 }
1405 #endif 1406 #endif
1406 } 1407 }
1407
1408 PySignal_SetWakeupFd(intpipe[1]);
1409 #endif 1408 #endif
1410 1409
1411 #if PY_MAJOR_VERSION >= 3 1410 #if PY_MAJOR_VERSION >= 3
1412 module = PyModule_Create(&_unixmodule); 1411 module = PyModule_Create(&_unixmodule);
1413 #else 1412 #else
1448 #endif 1447 #endif
1449 #elif defined USE_WAKEUP_FD 1448 #elif defined USE_WAKEUP_FD
1450 Py_AtExit(close_intpipe); 1449 Py_AtExit(close_intpipe);
1451 #endif 1450 #endif
1452 1451
1452 #ifdef USE_WAKEUP_FD
1453 PySignal_SetWakeupFd(intpipe[1]);
1454 #endif
1455
1453 #if PY_MAJOR_VERSION >= 3 1456 #if PY_MAJOR_VERSION >= 3
1454 return module; 1457 return module;
1455 #endif 1458 #endif
1456 } 1459 }