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

Thread status #2323

Open
giampaolo opened this issue Oct 25, 2023 · 0 comments
Open

Thread status #2323

giampaolo opened this issue Oct 25, 2023 · 0 comments

Comments

@giampaolo
Copy link
Owner

This idea was inspired by https://github.com/benfred/py-spy#how-do-you-detect-if-a-thread-is-idle-or-not.
It should be possible to determine thread status:

  • on Linux, by reading /proc/pid/status
  • on macOS, via thread_basic_info syscall
  • on Windows, by using multiple syscalls (see code)

The general idea is to be able to identify threads which are "idle", because it's useful. In order to achieve this the namedtuples returned by Process.threads() may provide either an is_active boolean field or a status field returning a string similar to the process STATUS_* constants.

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

No branches or pull requests

1 participant