fix bug 190889,允许操作并行时,再选择另1个大文件进行复制时,未进行并行复制

This commit is contained in:
lizhuoan 2023-09-05 17:19:16 +08:00 committed by Yue-Lan
parent d86aff37dd
commit 5cadce5000
1 changed files with 3 additions and 2 deletions

View File

@ -517,7 +517,8 @@ int FileCopy::doCopyBigFile(const char *srcPath, const char *destPath)
off_t offset = 0;
int syncCount = 0;
std::lock_guard<std::mutex> lock(fileMutex);
std::unique_lock<std::mutex> lock(fileMutex, std::defer_lock);
lock.lock();
in_fd = open(srcPath, O_RDONLY);
if (in_fd == -1) {
qDebug() << "Failed to open the source file";
@ -528,7 +529,7 @@ int FileCopy::doCopyBigFile(const char *srcPath, const char *destPath)
qDebug() << "Failed to get the source file status";
return ret;
}
lock.unlock();
out_fd = open(destPath, O_WRONLY | O_CREAT, stat_buf.st_mode);
if (out_fd == -1) {
qDebug() << "Failed to open the destination file";