fix deadlock

This commit is contained in:
lnk
2025-09-23 21:00:24 +08:00
parent b976795573
commit e997c88d82
5 changed files with 125 additions and 142 deletions

View File

@@ -181,14 +181,14 @@ void handleUploadResponse(const std::string& response, std::string& wavepath) {
std::cout << "File URL: " << url << std::endl;
// 找到最后一个 '.'
size_t pos = fileName.find_last_of('.');
size_t pos = name.find_last_of('.');
std::string nameWithoutExt;
if (pos != std::string::npos) {
// 截取去掉后缀的部分
nameWithoutExt = fileName.substr(0, pos);
nameWithoutExt = name.substr(0, pos);
} else {
// 如果没有后缀,直接使用原文件名
nameWithoutExt = fileName;
nameWithoutExt = name;
}
// 拷贝到 wavepath
@@ -1341,7 +1341,7 @@ bool get_monitor_id_by_dev_and_seq(const std::string& terminal_id,
unsigned short logical_seq,
std::string& out_monitor_id)
{
std::lock_guard<std::mutex> lk(ledgermtx); // 若你的工程里有全局 ledgermtx/terminal_devlist
std::lock_guard<std::mutex> lk(ledgermtx);
for (const auto& dev : terminal_devlist) {
if (dev.terminal_id != terminal_id) continue;