fixed gil usage in gevent plugin

This commit is contained in:
Roberto De Ioris
2012-10-18 16:06:53 +02:00
parent 2e66ae9abe
commit 6ea535a74d
+10
View File
@@ -316,6 +316,13 @@ PyMethodDef uwsgi_gevent_my_signal_def[] = { {"uwsgi_gevent_my_signal", py_uwsgi
PyMethodDef uwsgi_gevent_signal_handler_def[] = { {"uwsgi_gevent_signal_handler", py_uwsgi_gevent_signal_handler, METH_VARARGS, ""} };
PyMethodDef uwsgi_gevent_unix_signal_handler_def[] = { {"uwsgi_gevent_unix_signal_handler", py_uwsgi_gevent_graceful, METH_VARARGS, ""} };
void gil_gevent_get() {
pthread_setspecific(up.upt_gil_key, (void *) PyGILState_Ensure());
}
void gil_gevent_release() {
PyGILState_Release((PyGILState_STATE) pthread_getspecific(up.upt_gil_key));
}
void gevent_loop() {
@@ -326,6 +333,9 @@ void gevent_loop() {
// get the GIL
UWSGI_GET_GIL
up.gil_get = gil_gevent_get;
up.gil_release = gil_gevent_release;
struct uwsgi_socket *uwsgi_sock = uwsgi.sockets;
if (uwsgi.async < 2) {