Skip to content

Commit a18841b

Browse files
author
Sebastiano Merlino
committed
Removed code that managed python GIL
1 parent 912f341 commit a18841b

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

src/webserver.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131
#include <fcntl.h>
3232
#include <algorithm>
3333

34-
#ifdef WITH_PYTHON
35-
#include <Python.h>
36-
#endif
37-
3834
#include <microhttpd.h>
3935

4036
#include "gettext.h"
@@ -970,22 +966,10 @@ bool webserver::start(bool blocking)
970966
bool value_onclose = false;
971967
if(blocking)
972968
{
973-
#ifdef WITH_PYTHON
974-
if(PyEval_ThreadsInitialized())
975-
{
976-
Py_BEGIN_ALLOW_THREADS;
977-
}
978-
#endif //WITH_PYTHON
979969
pthread_mutex_lock(&mutexwait);
980970
while(blocking && running)
981971
pthread_cond_wait(&mutexcond, &mutexwait);
982972
pthread_mutex_unlock(&mutexwait);
983-
#ifdef WITH_PYTHON
984-
if(PyEval_ThreadsInitialized())
985-
{
986-
Py_END_ALLOW_THREADS;
987-
}
988-
#endif //WITH_PYTHON
989973
value_onclose = true;
990974
}
991975
return value_onclose;
@@ -1396,13 +1380,6 @@ int webserver::finalize_answer(MHD_Connection* connection, struct details::modde
13961380
cout << "Endpoint not found!" << endl;
13971381
#endif //DEBUG
13981382

1399-
#ifdef WITH_PYTHON
1400-
PyGILState_STATE gstate;
1401-
if(PyEval_ThreadsInitialized())
1402-
{
1403-
gstate = PyGILState_Ensure();
1404-
}
1405-
#endif //WITH_PYTHON
14061383
if(found)
14071384
{
14081385
try
@@ -1427,12 +1404,6 @@ int webserver::finalize_answer(MHD_Connection* connection, struct details::modde
14271404
{
14281405
not_found_page(&dhrs, mr);
14291406
}
1430-
#ifdef WITH_PYTHON
1431-
if(PyEval_ThreadsInitialized())
1432-
{
1433-
PyGILState_Release(gstate);
1434-
}
1435-
#endif //WITH_PYTHON
14361407
mr->dhrs = dhrs;
14371408
mr->dhrs->underlying_connection = connection;
14381409
try

0 commit comments

Comments
 (0)