coastline 0.0.4
Loading...
Searching...
No Matches
configsaver.h
Go to the documentation of this file.
1#pragma once
2
3#include <condition_variable>
4#include <filesystem>
5#include <mutex>
6#include <optional>
7#include <thread>
8#include <utility>
9
10#include "config.h"
11
12namespace coastline {
13
19public:
24 ConfigSaver(const ConfigSaver &) = delete;
26 ConfigSaver &operator=(const ConfigSaver &) = delete;
27
35
41 bool Flush();
42
44 bool Failed();
45
46private:
47 void Run();
48
49 std::mutex m_mutex;
53 bool m_writing = false;
54 bool m_failed = false;
55 bool m_stop = false;
56 std::thread m_thread;
57};
58
59} // namespace coastline
void Save(GameConfig config, std::filesystem::path path)
Queue a copy of the configuration for writing.
~ConfigSaver()
Write the copy that waits, if any, and stop the thread.
bool Flush()
Wait until every queued copy is written.
ConfigSaver(const ConfigSaver &)=delete
Prevent copying the writing thread.
ConfigSaver & operator=(const ConfigSaver &)=delete
Prevent assignment of the writing thread.
The settings of BossRally.ini.
Definition config.h:18
Definition assetimport.h:11