[Python.NET] AcquireThreadLock - bug? future?

Roman Yakovenko roman.yakovenko at gmail.com
Mon Mar 14 07:23:39 CET 2005

Hi. I have small problem with multithreading and need help to solve it.
I have dll written in managed C++. Within dll I have class that has
static function. I'd like to call this function from a few threads
from python. I failed to do this. Calling function staled and this is
a stack dump from debugger ( of my program )

python.runtime.dll!Python.Runtime.PythonEngine.AcquireThreadLock() + 0x40 bytes	

python.runtime.dll!Python.Runtime.MethodBinder.Invoke(int inst =
11793552, int args = 9900080, int kw = 0) + 0xf0 bytes

python.runtime.dll!Python.Runtime.MethodObject.Invoke(int target =
11793552, int args = 9900080, int kw = 0) + 0x25 bytes

python.runtime.dll!Python.Runtime.MethodBinding.tp_call(int ob =
11794928, int args = 9900080, int kw = 0) + 0x137 bytes

I don't understand:
    1. Why Python.Net tries to acquire thread lock, while calling function ? 
        I am possible to call get property from a few threads. From
managed C++ point of view ( I could be wrong here ) getting value of
property it is just syntax sugaring for get_??? call. I want to say
that if I able to call "get property" from a few threads I should be
able to call function from a few threads.
    2. Why at all Python.Net tries to synchronize function calls?

I can modify and compile source code of Python.Net, but I know to
little about reasons
of calling AcquireThreadLock.

Thanks for help


More information about the PythonDotNet mailing list