Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: More Detail Thread State #740

Open
andylibrian opened this issue Jan 5, 2025 · 0 comments
Open

Question: More Detail Thread State #740

andylibrian opened this issue Jan 5, 2025 · 0 comments

Comments

@andylibrian
Copy link

Hi! I'm curious whether it's feasible to get a more detailed thread state. Specifically, I'd like to be able to determine thread states like:

  • New/Created: A thread is created but not started yet. This is when the thread object is initialized, but start() has not been called.
  • Runnable: Once start() is called, the thread is ready to run but might be waiting for CPU scheduling.
  • Running: The thread is actively running.
  • Waiting/Blocked: The thread is waiting for a lock, I/O, or another resource. This can happen explicitly (e.g., waiting on a Condition or Event) or implicitly (e.g., during I/O operations).
  • Terminated/Stopped: After the thread's run() method completes, it moves to the stopped state.

I see that the existing dump output contains:

    "active": true,
    "owns_gil": false,

Is it feasible to reliably determine these thread states using py-spy's existing infrastructure?

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

No branches or pull requests

1 participant