Linux: How can I find the thread which holds a particular lock?
问题 I have a multi-threads program which is running on Linux, sometimes if I run gstack against it, there is a thread was waiting for a lock for a long time(say, 2-3 minutes), Thread 2 (Thread 0x5e502b90 (LWP 19853)): 0 0x40000410 in __kernel_vsyscall () 1 0x400157b9 in __lll_lock_wait () from /lib/i686/nosegneg/libpthread.so.0 2 0x40010e1d in _L_lock_981 () from /lib/i686/nosegneg/libpthread.so.0 3 0x40010d3b in pthread_mutex_lock () from /lib/i686/nosegneg/libpthread.so.0 ... I checked the rest