From b1f3e48b2b33eddcf51f3a753d2df98fc18ee487 Mon Sep 17 00:00:00 2001 From: "roberto@sirius" Date: Sun, 28 Mar 2010 18:21:23 +0200 Subject: [PATCH] uGreen fix --- ugreen.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/ugreen.c b/ugreen.c index 93bf651a..376c9689 100644 --- a/ugreen.c +++ b/ugreen.c @@ -1,5 +1,17 @@ #ifdef UWSGI_UGREEN +/* uGreen -> uWSGI green threads */ + +/* + +TODO + +page-guards in stack +configurable stack size +io and sleep management + +*/ + #include "uwsgi.h" #define GREEN_STACK_SIZE 128 * 1024 @@ -59,22 +71,8 @@ PyObject *py_uwsgi_green_schedule(PyObject * self, PyObject * args) { struct wsgi_request *wsgi_req = current_wsgi_req(&uwsgi); - /* - int py_current_recursion_depth; - struct _frame* py_current_frame; - - PyThreadState* tstate = PyThreadState_GET(); - py_current_recursion_depth = tstate->recursion_depth; - py_current_frame = tstate->frame; - */ u_green_schedule_to_main(&uwsgi, wsgi_req->async_id); - /* - tstate = PyThreadState_GET(); - tstate->recursion_depth = py_current_recursion_depth; - tstate->frame = py_current_frame ; - */ - Py_INCREF(Py_True); return Py_True; @@ -144,7 +142,7 @@ void u_green_loop(struct uwsgi_server *uwsgi) { PyMethodDef *uwsgi_function; - fprintf(stderr,"initializing %d green threads with stack size of %lu (%lu KB)\n", uwsgi->async, (unsigned long) GREEN_STACK_SIZE, (unsigned long) GREEN_STACK_SIZE/1024); + fprintf(stderr,"initializing %d uGreen threads with stack size of %lu (%lu KB)\n", uwsgi->async, (unsigned long) GREEN_STACK_SIZE, (unsigned long) GREEN_STACK_SIZE/1024); uwsgi->green_stacks = malloc( sizeof(char*) * uwsgi->async); if (!uwsgi->green_stacks) {