Skip to content

Surround the GIL with a ReentrantLock on the Julia side.#637

Open
mkitti wants to merge 7 commits intoJuliaPy:mainfrom
mkitti:mkitti-jl-gil-lock
Open

Surround the GIL with a ReentrantLock on the Julia side.#637
mkitti wants to merge 7 commits intoJuliaPy:mainfrom
mkitti:mkitti-jl-gil-lock

Conversation

@mkitti
Copy link
Member

@mkitti mkitti commented Jul 7, 2025

The Python GIL should only be able obtained by a single Julia thread / task.
To enforce this, we use a ReentrantLock on the Julia side that must be obtained
before trying to acquire the Python GIL.

Implements the fix suggested by #627 by @NHDaly and @kpamnany

Also inspired by https://stackoverflow.com/questions/47167251/pygilstate-ensure-causing-deadlock/49202868#49202868

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants