fixed a race condition in SIGINT/SIGQUIT

This commit is contained in:
roberto@oneiric64
2012-01-22 17:55:09 +01:00
parent 5d9d67caa4
commit 40f7aecbba
6 changed files with 45 additions and 17 deletions

View File

@@ -194,7 +194,12 @@ void uwsgi_python_atexit() {
// this time we use this higher level function
// as this code can be executed in a signal handler
PyGILState_Ensure();
if (!Py_IsInitialized()) {
return;
}
if (uwsgi.has_threads)
PyGILState_Ensure();
// no need to worry about freeing memory
PyObject *uwsgi_dict = get_uwsgi_pydict("uwsgi");
if (uwsgi_dict) {