Skip to content

3.13 freethreaded deadlock #4738

Answered by colesbury
RCoder01 asked this question in Questions
Nov 27, 2024 · 2 comments · 9 replies
Discussion options

You must be logged in to vote

This is expected behavior. In the original example, you need py.allow_threads around the join() call. In @davidhewitt's example, you need a py.allow_threads around the barrier.wait().

There's a brief description about this in the C API "howto". You need to use the GIL state APIs in the same places as you would use them in the default (with GIL) build.

Although free threading allows multiple threads to be attached to the Python VM at once, there are some times where a single thread requires exclusive access (a stop-the-world pause). Here are a few examples:

  • During garbage collection in order to get a globally consistent view of reference counts and references between objects
  • In 3.13t (but…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
8 replies
@RCoder01
Comment options

@davidhewitt
Comment options

@colesbury
Comment options

Answer selected by RCoder01
@davidhewitt
Comment options

@colesbury
Comment options

@davidhewitt
Comment options

@ngoldbaum
Comment options

Comment options

You must be logged in to vote
1 reply
@colesbury
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants