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


Groups > comp.lang.python > #196402 > unrolled thread

Re: PyGILState_Ensure() deadlocks, why?

Started byBarry <barry@barrys-emacs.org>
First post2024-07-07 23:21 +0100
Last post2024-07-07 23:21 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#196402 — Re: PyGILState_Ensure() deadlocks, why?

FromBarry <barry@barrys-emacs.org>
Date2024-07-07 23:21 +0100
SubjectRe: PyGILState_Ensure() deadlocks, why?
Message-ID<mailman.17.1720392652.2981.python-list@python.org>

> 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


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web