[Python-Dev] Preventing PyEval_AcquireLock deadlock

Robin Dunn robin@alldunn.com
Fri, 14 Sep 2001 13:52:44 -0700


> Let's take a step back.  Why do you need this?  I'm guessing that you
> have a C++ library that calls C++ callbacks, and now you want to call
> a Python callback from your C++ callback.  The proper solution is to
> make sure that you *always* release the Python lock before entering
> your event loop or anything else that could possibly call callbacks.
> See _tkinter for how I handled it there.  It's ugly, but possible.

Yep, I've already got it working this way except there are a few code paths
that result in a callback sometimes being called indirectly from a different
part of the code where the Python lock is already acquired.  I was hoping to
be able to use a general solution instead of having to find all those
situations and special-case them.  Oh well.

Thanks anyway.

--
Robin Dunn
Software Craftsman
robin@AllDunn.com       Java give you jitters?
http://wxPython.org      Relax with wxPython!