- Fix bug with retval not treated as a bool value in wait_unlock()
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@523 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
b6f23767cb
commit
c3065a86c6
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2006-03-10 03:20 jinx
|
||||||
|
|
||||||
|
* trunk/doc/sgpem2uman.texi: Added chapters Overview of SGPEM and
|
||||||
|
Starting with SGPEM
|
||||||
|
|
||||||
|
2006-03-09 22:20 tchernobog
|
||||||
|
|
||||||
|
* trunk/ChangeLog, trunk/Makefile.am,
|
||||||
|
trunk/src/backend/pyloader/python_policy.cc,
|
||||||
|
trunk/src/testsuite/test-python_loader.cc: - Make
|
||||||
|
test-python_loader a unit test instead of an integration test
|
||||||
|
|
||||||
2006-03-09 21:56 tchernobog
|
2006-03-09 21:56 tchernobog
|
||||||
|
|
||||||
* trunk/Makefile.am, trunk/src/backend/observed_subject.hh,
|
* trunk/Makefile.am, trunk/src/backend/observed_subject.hh,
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
using namespace sgpem;
|
using namespace sgpem;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#define WAIT_FOR (250000)
|
||||||
|
|
||||||
// WARNING : this class needs extensive and above all
|
// WARNING : this class needs extensive and above all
|
||||||
// *strong* exception checking / handling!
|
// *strong* exception checking / handling!
|
||||||
|
|
||||||
|
@ -160,20 +162,18 @@ PythonPolicy::wait_unlock() const throw(UserInterruptException)
|
||||||
int i = 0; // We give the sort_queue() three seconds max time, then...
|
int i = 0; // We give the sort_queue() three seconds max time, then...
|
||||||
// we shot it stone dead! Bang.
|
// we shot it stone dead! Bang.
|
||||||
|
|
||||||
std::cout << "waiting unlock" << std::endl;
|
|
||||||
|
|
||||||
bool still_locked;
|
bool still_locked;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Py_UNBLOCK_THREADS;
|
Py_UNBLOCK_THREADS;
|
||||||
usleep(25000); // hack'a'ton! magggggiccc nummmbeeerrrrrs!!
|
usleep(WAIT_FOR); // hack'a'ton! magggggiccc nummmbeeerrrrrs!!
|
||||||
Py_BLOCK_THREADS;
|
Py_BLOCK_THREADS;
|
||||||
|
|
||||||
PyObject* retval = PyObject_CallMethod(_lock, "test", NULL);
|
PyObject* retval = PyObject_CallMethod(_lock, "test", NULL);
|
||||||
still_locked = static_cast<bool>(PyInt_AsLong(retval));
|
still_locked = PyBool_Check(retval);
|
||||||
Py_DECREF(retval);
|
Py_DECREF(retval);
|
||||||
|
|
||||||
if(i++ > 120)
|
if(i++ > WAIT_FOR*12)
|
||||||
{
|
{
|
||||||
PyThreadState_Clear(_save);
|
PyThreadState_Clear(_save);
|
||||||
PyEval_RestoreThread(_save);
|
PyEval_RestoreThread(_save);
|
||||||
|
|
Loading…
Reference in New Issue