| 36 | // |
| 37 | |
| 38 | struct CLockLocation { |
| 39 | CLockLocation( |
| 40 | const char* pszName, |
| 41 | const char* pszFile, |
| 42 | int nLine, |
| 43 | bool fTryIn, |
| 44 | const std::string& thread_name) |
| 45 | : fTry(fTryIn), |
| 46 | mutexName(pszName), |
| 47 | sourceFile(pszFile), |
| 48 | m_thread_name(thread_name), |
| 49 | sourceLine(nLine) {} |
| 50 | |
| 51 | std::string ToString() const |
| 52 | { |
| 53 | return strprintf( |
| 54 | "'%s' in %s:%s%s (in thread '%s')", |
| 55 | mutexName, sourceFile, sourceLine, (fTry ? " (TRY)" : ""), m_thread_name); |
| 56 | } |
| 57 | |
| 58 | std::string Name() const |
| 59 | { |
| 60 | return mutexName; |
| 61 | } |
| 62 | |
| 63 | private: |
| 64 | bool fTry; |
| 65 | std::string mutexName; |
| 66 | std::string sourceFile; |
| 67 | const std::string& m_thread_name; |
| 68 | int sourceLine; |
| 69 | }; |
| 70 | |
| 71 | using LockStackItem = std::pair<void*, CLockLocation>; |
| 72 | using LockStack = std::vector<LockStackItem>; |