Skip to content

Commit b7674bd

Browse files
committed
attempt to improve clarity/intention
1 parent 28a918d commit b7674bd

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

libmamba/include/mamba/download/mirror.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <functional>
1111
#include <memory>
12-
#include <mutex>
1312
#include <optional>
1413
#include <string>
1514
#include <vector>

libmamba/src/core/output.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,6 @@ namespace mamba
276276

277277
using ConsoleBuffer = std::vector<std::string>;
278278

279-
struct ConsoleSynchedData
280-
{
281-
std::unique_ptr<ProgressBarManager> progress_bar_manager;
282-
ConsoleBuffer buffer;
283-
};
284279

285280
class ConsoleData
286281
{
@@ -297,15 +292,20 @@ namespace mamba
297292
ConsoleData(ConsoleData&&) noexcept = delete;
298293
ConsoleData& operator=(ConsoleData&&) noexcept = delete;
299294

295+
300296
const Context& m_context;
301297

302298
std::string json_hier;
303299
unsigned int json_index = 0;
304300
nlohmann::json json_log;
305301
bool is_json_print_cancelled = false;
306302

307-
308-
util::synchronized_value<ConsoleSynchedData> m_synched_data;
303+
struct Data
304+
{
305+
std::unique_ptr<ProgressBarManager> progress_bar_manager;
306+
ConsoleBuffer buffer;
307+
};
308+
util::synchronized_value<Data> m_synched_data;
309309

310310
TaskSynchronizer m_tasksync;
311311
};

libmamba/src/core/util.cpp

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,26 +1065,7 @@ namespace mamba
10651065
#pragma GCC diagnostic pop
10661066
#endif
10671067

1068-
struct LockedFilesData
1069-
{
1070-
// TODO: replace by something like boost::multiindex or equivalent to avoid having to
1071-
// handle 2 hashmaps
1072-
std::unordered_map<fs::u8path, std::weak_ptr<LockFileOwner>> locked_files; // TODO:
1073-
// consider
1074-
// replacing
1075-
// by real
1076-
// concurrent
1077-
// set to
1078-
// avoid
1079-
// having to
1080-
// lock the
1081-
// whole
1082-
// container
1083-
1084-
std::unordered_map<int, fs::u8path> fd_to_locked_path; // this is a workaround the
1085-
// usage of file descriptors on
1086-
// linux instead of paths
1087-
};
1068+
10881069

10891070
class LockedFilesRegistry
10901071
{
@@ -1188,7 +1169,31 @@ namespace mamba
11881169
std::atomic_bool m_is_file_locking_allowed{ true };
11891170
std::atomic<std::chrono::seconds> m_default_lock_timeout{ std::chrono::seconds::zero() };
11901171

1191-
util::synchronized_value<LockedFilesData, std::recursive_mutex> m_data;
1172+
struct Data
1173+
{
1174+
// TODO: replace by something like boost::multiindex or equivalent to avoid having
1175+
// to handle 2 hashmaps
1176+
std::unordered_map<fs::u8path, std::weak_ptr<LockFileOwner>> locked_files; // TODO:
1177+
// consider
1178+
// replacing
1179+
// by
1180+
// real
1181+
// concurrent
1182+
// set
1183+
// to
1184+
// avoid
1185+
// having
1186+
// to
1187+
// lock
1188+
// the
1189+
// whole
1190+
// container
1191+
1192+
std::unordered_map<int, fs::u8path> fd_to_locked_path; // this is a workaround the
1193+
// usage of file descriptors
1194+
// on linux instead of paths
1195+
};
1196+
util::synchronized_value<Data, std::recursive_mutex> m_data;
11921197
};
11931198

11941199
static LockedFilesRegistry files_locked_by_this_process;

0 commit comments

Comments
 (0)