| 129 | } |
| 130 | |
| 131 | static void double_lock_detected(const void* mutex, const LockStack& lock_stack) |
| 132 | { |
| 133 | LogPrintf("DOUBLE LOCK DETECTED\n"); |
| 134 | LogPrintf("Lock order:\n"); |
| 135 | for (const LockStackItem& i : lock_stack) { |
| 136 | std::string prefix{}; |
| 137 | if (i.first == mutex) { |
| 138 | prefix = " (*)"; |
| 139 | } |
| 140 | LogPrintf("%s %s\n", prefix, i.second.ToString()); |
| 141 | } |
| 142 | if (g_debug_lockorder_abort) { |
| 143 | tfm::format(std::cerr, |
| 144 | "Assertion failed: detected double lock for %s, details in debug log.\n", |
| 145 | lock_stack.back().second.ToString()); |
| 146 | abort(); |
| 147 | } |
| 148 | throw std::logic_error("double lock detected"); |
| 149 | } |
| 150 | |
| 151 | template <typename MutexType> |
| 152 | static void push_lock(MutexType* c, const CLockLocation& locklocation) |