mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-05-02 04:43:35 +00:00
31 lines
748 B
C
31 lines
748 B
C
#include "uwsgi_python.h"
|
|
|
|
extern struct uwsgi_server uwsgi;
|
|
extern struct uwsgi_python up;
|
|
|
|
void gil_real_get() {
|
|
//uwsgi_log("LOCK %d\n", uwsgi.mywid);
|
|
#ifndef PYTHREE
|
|
PyEval_AcquireLock();
|
|
PyThreadState_Swap((PyThreadState *) pthread_getspecific(up.upt_gil_key));
|
|
#else
|
|
PyEval_RestoreThread((PyThreadState *) pthread_getspecific(up.upt_gil_key));
|
|
#endif
|
|
|
|
//uwsgi_log("LOCKED !!! %d\n", uwsgi.mywid);
|
|
}
|
|
|
|
void gil_real_release() {
|
|
//uwsgi_log("UNLOCK %d\n", uwsgi.mywid);
|
|
#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() {}
|
|
void gil_fake_release() {}
|