Skip to content

Commit

Permalink
fixed python2.x threads
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto@maverick64 committed Mar 3, 2011
1 parent 806765d commit b867b11
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/python/gil.c
Expand Up @@ -4,20 +4,22 @@ extern struct uwsgi_server uwsgi;
extern struct uwsgi_python up;

void gil_real_get() {
/*
#ifndef PYTHREE
PyEval_AcquireLock();
PyThreadState_Swap((PyThreadState *) pthread_getspecific(up.upt_gil_key));
*/
#else
PyEval_RestoreThread((PyThreadState *) pthread_getspecific(up.upt_gil_key));
#endif
}

void gil_real_release() {
/*
#ifndef PYTHREE
pthread_setspecific(up.upt_gil_key, (void *) PyThreadState_Swap(NULL));
PyEval_ReleaseLock();
*/
#else
pthread_setspecific(up.upt_gil_key, (void *) PyThreadState_Get());
PyEval_SaveThread();
#endif
}

void gil_fake_get() {}
Expand Down

0 comments on commit b867b11

Please sign in to comment.