Is it possible to determine the thread holding a mutex?
You can use knowledge of the mutex internals to do this. Ordinarily this wouldn’t be a very good idea, but it’s fine for debugging. Under Linux with the NPTL implementation of pthreads (which is any modern glibc), you can examine the __data.__owner member of the pthread_mutex_t structure to find out the thread that currently has … Read more