mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-08 06:31:58 +00:00
fixed threaded loading
This commit is contained in:
@@ -4,7 +4,7 @@ extern struct uwsgi_server uwsgi;
|
||||
extern struct uwsgi_python up;
|
||||
|
||||
void gil_real_get() {
|
||||
uwsgi_log("LOCK %d\n", uwsgi.mywid);
|
||||
//uwsgi_log("LOCK %d\n", uwsgi.mywid);
|
||||
#ifndef PYTHREE
|
||||
PyEval_AcquireLock();
|
||||
PyThreadState_Swap((PyThreadState *) pthread_getspecific(up.upt_gil_key));
|
||||
@@ -14,7 +14,7 @@ void gil_real_get() {
|
||||
}
|
||||
|
||||
void gil_real_release() {
|
||||
uwsgi_log("UNLOCK %d\n", uwsgi.mywid);
|
||||
//uwsgi_log("UNLOCK %d\n", uwsgi.mywid);
|
||||
#ifndef PYTHREE
|
||||
pthread_setspecific(up.upt_gil_key, (void *) PyThreadState_Swap(NULL));
|
||||
PyEval_ReleaseLock();
|
||||
|
||||
@@ -303,6 +303,7 @@ int init_uwsgi_app(int loader, void *arg1, struct wsgi_request *wsgi_req, PyThre
|
||||
if (uwsgi.threads > 1 && id) {
|
||||
// if we have multiple threads we need to initialize a PyThreadState for each one
|
||||
for(i=0;i<uwsgi.threads;i++) {
|
||||
//uwsgi_log("%p\n", uwsgi.core[i]->ts[id]);
|
||||
uwsgi.core[i]->ts[id] = PyThreadState_New( ((PyThreadState *)wi->interpreter)->interp);
|
||||
if (!uwsgi.core[i]->ts[id]) {
|
||||
uwsgi_log("unable to allocate new PyThreadState structure for app %s", mountpoint);
|
||||
|
||||
@@ -162,8 +162,6 @@ void uwsgi_python_reset_random_seed() {
|
||||
|
||||
void uwsgi_python_post_fork() {
|
||||
|
||||
uwsgi_log("POST FORK %d\n", uwsgi.mywid);
|
||||
|
||||
uwsgi_python_reset_random_seed();
|
||||
|
||||
#ifdef UWSGI_EMBEDDED
|
||||
@@ -178,8 +176,6 @@ void uwsgi_python_post_fork() {
|
||||
PyErr_Clear();
|
||||
#endif
|
||||
|
||||
uwsgi_log("RELEASING GIL %d\n", uwsgi.mywid);
|
||||
|
||||
UWSGI_RELEASE_GIL
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user