bumped to 1.1 and added uwsgi.atexit

This commit is contained in:
roberto@oneiric64
2012-01-12 19:25:54 +01:00
parent f87761d092
commit 65f1445b64
4 changed files with 39 additions and 1 deletions
+15
View File
@@ -195,6 +195,18 @@ void uwsgi_python_reset_random_seed() {
#endif
}
void uwsgi_python_atexit() {
// no need to worry about freeing memory
PyObject *uwsgi_dict = get_uwsgi_pydict("uwsgi");
if (uwsgi_dict) {
PyObject *ae = PyDict_GetItemString(uwsgi_dict, "atexit");
if (ae) {
python_call(ae, PyTuple_New(0), 0, NULL);
}
}
}
void uwsgi_python_post_fork() {
#ifdef UWSGI_SPOOLER
@@ -1441,6 +1453,7 @@ void uwsgi_python_fixup() {
uwsgi.p[30] = uwsgi_malloc( sizeof(struct uwsgi_plugin) );
memcpy(uwsgi.p[30], uwsgi.p[0], sizeof(struct uwsgi_plugin) );
uwsgi.p[30]->init_thread = NULL;
uwsgi.p[30]->atexit = NULL;
}
void uwsgi_python_hijack(void) {
@@ -1550,6 +1563,8 @@ struct uwsgi_plugin python_plugin = {
.spooler = uwsgi_python_spooler,
.atexit = uwsgi_python_atexit,
.code_string = uwsgi_python_code_string,
.help = uwsgi_python_help,