Significantly changed how the Python interpreter lock and thread state

are managed, which should fix the problem of running on a
multi-processor machine.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-09-17 21:47:20 +00:00
parent 80823340ab
commit 059a841c96
27 changed files with 3034 additions and 1070 deletions

View File

@@ -279,7 +279,7 @@ protected:
if (bufsize == 0)
return 0;
bool doSave = wxPyRestoreThread();
wxPyTState* state = wxPyBeginBlockThreads();
PyObject* arglist = Py_BuildValue("(i)", bufsize);
PyObject* result = PyEval_CallObject(read, arglist);
Py_DECREF(arglist);
@@ -297,7 +297,7 @@ protected:
}
else
m_lasterror = wxSTREAM_READ_ERROR;
wxPySaveThread(doSave);
wxPyEndBlockThreads(state);
m_lastcount = o;
return o;
}
@@ -308,17 +308,17 @@ protected:
}
virtual off_t OnSysSeek(off_t off, wxSeekMode mode){
bool doSave = wxPyRestoreThread();
wxPyTState* state = wxPyBeginBlockThreads();
PyObject*arglist = Py_BuildValue("(ii)", off, mode);
PyObject*result = PyEval_CallObject(seek, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
wxPySaveThread(doSave);
wxPyEndBlockThreads(state);
return OnSysTell();
}
virtual off_t OnSysTell() const{
bool doSave = wxPyRestoreThread();
wxPyTState* state = wxPyBeginBlockThreads();
PyObject* arglist = Py_BuildValue("()");
PyObject* result = PyEval_CallObject(tell, arglist);
Py_DECREF(arglist);
@@ -327,7 +327,7 @@ protected:
o = PyInt_AsLong(result);
Py_DECREF(result);
};
wxPySaveThread(doSave);
wxPyEndBlockThreads(state);
return o;
}
@@ -337,12 +337,12 @@ protected:
public:
~wxPyCBInputStream() {
bool doSave = wxPyRestoreThread();
wxPyTState* state = wxPyBeginBlockThreads();
Py_XDECREF(py);
Py_XDECREF(read);
Py_XDECREF(seek);
Py_XDECREF(tell);
wxPySaveThread(doSave);
wxPyEndBlockThreads(state);
}
virtual size_t GetSize() {