What is the linux API to query the status of a thread, like the top -H command can do? I do not need portability, it just has to work on modern x86[_64] linux.
I do not want to only know if the thread is alive or terminated. I need to know if it’s sleeping also.
As far as I know
topreads its information from/proc, on Linux at least.Update: For
top‘s sources you might like to read here: Procps – The /proc file system utilities