aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source/main.h
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-02-27 04:57:47 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-02-27 04:57:47 +0000
commit4890f929915b27e94cce04d19ab4e72cfbe93715 (patch)
tree93f48861ce0c1b46acd3e8f13a277785f13e77dd /externals/grill/py/source/main.h
parent3e90874e5d63137c195c3b3c1ce90b542deb8a51 (diff)
better error reporting
use lock count instead of message queuing to avoid py->py messaging deadlock must clear Python error... svn path=/trunk/; revision=2585
Diffstat (limited to 'externals/grill/py/source/main.h')
-rw-r--r--externals/grill/py/source/main.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index b7000bae..e1ae64a4 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -159,16 +159,20 @@ public:
inline void Lock() { mutex.Unlock(); }
inline void Unlock() { mutex.Unlock(); }
+ // this is respecially needed when one py/pyext object calls another one
+ // we don't want the message to be queued, but otoh we have to avoid deadlock
+ static int lockcount;
+
inline PyThreadState *PyLock()
{
- PyEval_AcquireLock();
+ if(!lockcount++) PyEval_AcquireLock();
return PyThreadState_Swap(FindThreadState());
}
inline void PyUnlock(PyThreadState *st)
{
PyThreadState_Swap(st);
- PyEval_ReleaseLock();
+ if(!--lockcount) PyEval_ReleaseLock();
}
#else
inline void Lock() {}