[Python-Dev] Preventing PyEval_AcquireLock deadlock
Tim Peters
tim.one@home.com
Fri, 14 Sep 2001 17:20:31 -0400
Robin, you may also profit from looking at Mark Hammond's utility classes in
the win32all extensions, and exploiting platform TLS (thread-local storage)
can make it easy to give each thread a "do I own the lock?" flag -- but you
need to establish choke points in your own code, i.e. a protocol of your own
for dealing with threads, wrapping the raw Python C API.
> 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.
You can, but the general solution has to come from you now. Callbacks in
the presence of threads are a bitch, and redesigning this part of the Python
C API is something the thread-SIG intended to tackle but didn't accomplish.