Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #196402

Re: PyGILState_Ensure() deadlocks, why?

From Barry <barry@barrys-emacs.org>
Newsgroups comp.lang.python
Subject Re: PyGILState_Ensure() deadlocks, why?
Date 2024-07-07 23:21 +0100
Message-ID <mailman.17.1720392652.2981.python-list@python.org> (permalink)
References <DGC1c0YSrMcV0n6rNNeplHySXzBWUfTUwJbBVPgOocO1evufk5MKe8QWWEzO6Zj5-_0VrJJbK3OpB5-vrvMdDRKITiZrvq0RMY69IND05u4=@protonmail.ch> <BFD66552-780D-4B47-BE26-AA01988E3D07@barrys-emacs.org>

Show all headers | View raw



> On 7 Jul 2024, at 22:09, Tomas Ukkonen via Python-list <python-list@python.org> wrote:
> 
>     Py_Initialize();

You also need to tell python to init threading.
I think you are missing more python setup code before you can use threads.
Also i think you need to tell python that your thread wants to call into python.
But I an not near my dev system to research this for you.

I have code to use python from C++ in my pysvn project.
See the code starting a line 354 in https://sourceforge.net/p/pysvn/code/HEAD/tree/trunk/pysvn/Extension/Source/pysvn.cpp
That saves the thread state and restores it.

But in my case python creates the threads and I release and acquire the GIL.

Barry


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: PyGILState_Ensure() deadlocks, why? Barry <barry@barrys-emacs.org> - 2024-07-07 23:21 +0100

csiph-web