How do I count the number of running threads (pthreads)?

后端 未结 3 1098
眼角桃花
眼角桃花 2021-01-19 23:46

If I search for counting the number of threads an application has, all the answers involve external programs like top. I want to count the threads within the ap

3条回答
  •  醉酒成梦
    2021-01-20 00:01

    You could write a tiny wrapper for pthread_create that counts created threads and link against that wrapper after you linked against the immutable library.

提交回复
热议问题