Using pthreads if there is any “intelligent” way to get all the threadIDs created using pthread_created within an process, supposing those threads are created in the third party library that does not expose those data.
Using pthreads if there is any intelligent way to get all the threadID s
Share
One way to do it is to create a replacement function for pthread_create, and use the LD_PRELOAD.
Of course you don’t want to reimplement pthread_create, so you have to call pthread_create somehow, but you can ask the dynamic loader to load it for you :
Then you compile it to a shared library :
And you can use it with any dynamically linked prog :
Note : This is an adpated version of this blog post