Any of you know how to determine which thread holds a mutex? This would be NPTL code that we'd be looking for (and I don't want to extend it).
Thanks!
Kennedy
Any of you know how to determine which thread holds a mutex? This would be NPTL code that we'd be looking for (and I don't want to extend it).
Thanks!
Kennedy
Does this help?
NPTL Trace Tool Project
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I don't have a clue. Maybe. That may be similar to backtrace() (which is currently under development for the platform I'm on in uClibC). . . . and ewe! it is a patch to the LibC (also appears to be only available for GlibC).
I will look into it more, however. Perhaps I can port it over to uClibC and give back to the community .
Thanks!
I've used a wrapper function around mutex locking and unlocking calls for this purpose, basically passing the thread ID and mutex address as arguments to the wrapper, and having the wrapper keep a list of what threads have what mutexes locked. Use lookup functions to get the information you need out of the list.
Since it wasn't for anything terribly important, I didn't have to worry about offsetting timing issues when debugging, or maintaining high efficiency in production. This method may or may not be useful for you, but it is an easy way to do what you are asking.