diff options
author | elfmz <fenix1905@tut.by> | 2022-10-27 23:42:43 +0300 |
---|---|---|
committer | elfmz <fenix1905@tut.by> | 2022-10-27 23:42:43 +0300 |
commit | a2ece88875e4038ef330765439af9eff8520a2de (patch) | |
tree | 9b0d498d0d1ac0910e1297884d13369f4e17be17 /far2l/src/mix | |
parent | 78458d8afb5216c55ebe384b08e688e4ffc79b3d (diff) |
minor
Diffstat (limited to 'far2l/src/mix')
-rw-r--r-- | far2l/src/mix/MountInfo.cpp | 19 | ||||
-rw-r--r-- | far2l/src/mix/MountInfo.h | 5 |
2 files changed, 14 insertions, 10 deletions
diff --git a/far2l/src/mix/MountInfo.cpp b/far2l/src/mix/MountInfo.cpp index 16c4e096..cac3efe2 100644 --- a/far2l/src/mix/MountInfo.cpp +++ b/far2l/src/mix/MountInfo.cpp @@ -180,15 +180,18 @@ static bool SkipForLocationMenu(const char *path) MountInfo::MountInfo(bool for_location_menu) { - // force-enable multi-threaded disk access: echo e > ~/.config/far2l/mtfs - // force-disable multi-threaded disk access: echo d > ~/.config/far2l/mtfs - FDScope fd(open(InMyConfig("mtfs").c_str(), O_RDONLY)); - if (fd.Valid()) { - if (os_call_ssize(read, (int)fd, (void *)&_mtfs, sizeof(_mtfs)) == 0) { - _mtfs = 'e'; + if (!for_location_menu) { + // force-enable multi-threaded disk access: echo e > ~/.config/far2l/mtfs + // force-disable multi-threaded disk access: echo d > ~/.config/far2l/mtfs + FDScope fd(open(InMyConfig("mtfs").c_str(), O_RDONLY)); + if (fd.Valid()) { + if (os_call_ssize(read, (int)fd, (void *)&_mtfs, sizeof(_mtfs)) == 0) { + _mtfs = 'e'; + } + fprintf(stderr, "%s: _mtfs='%c'\n", __FUNCTION__, _mtfs); } - fprintf(stderr, "%s: _mtfs='%c'\n", __FUNCTION__, _mtfs); } + _mountpoints = std::make_shared<Mountpoints>(); #ifdef __linux__ @@ -292,10 +295,10 @@ MountInfo::MountInfo(bool for_location_menu) (std::chrono::steady_clock::now().time_since_epoch()); { std::unique_lock<std::mutex> lock(_mountpoints->pending.mtx); - _mountpoints->pending.cond.wait_for(lock, std::chrono::milliseconds(1000 - ms)); if (_mountpoints->pending.cnt == 0) { break; } + _mountpoints->pending.cond.wait_for(lock, std::chrono::milliseconds(1000 - ms)); } ms+= (std::chrono::duration_cast< std::chrono::milliseconds > (std::chrono::steady_clock::now().time_since_epoch()) - ms_before).count(); diff --git a/far2l/src/mix/MountInfo.h b/far2l/src/mix/MountInfo.h index ce4bbddd..be1bc2ea 100644 --- a/far2l/src/mix/MountInfo.h +++ b/far2l/src/mix/MountInfo.h @@ -17,8 +17,9 @@ struct Mountpoint struct Mountpoints; -/* This class enumerates mountpoints and also provides extra information - * like disk sizes (if for_location_menu enabled) and also it detects +/* This class enumerates mountpoints and provides extra info + * like disk sizes (if for_location_menu enabled) and also + * (if for_location_menu disabled) - it provides ability to check * if specified path points to device that is best to be * accessed in multi-thread parallel manner, like SSD drives. * Later currently works only under Linux, others defaulted to <true>. |