I have a process with 100 threads.
I know that only one thread is using a specific fd
.
For example, this fd
is a socket descriptor, and only one thread is using this socket with send()
and receive()
.
How can I find out, with C, on Linux, the ID of this thread?
Is there a smarter way than attaching to each thread with ptrace
and waiting until one of them will be detected?