Skip to content

Do you need to disable gil / allow threads in rust-spawned threads? #2112

Answered by birkenfeld
ntakouris asked this question in Questions
Discussion options

You must be logged in to vote

thread::spawn knows nothing about the GIL, so the spawned code does not hold or acquire the GIL.

Consequently, you also should not be able to use any Python stuff in the thread without calling with_gil. If you can, that's a bug.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ntakouris
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants