diff options
| author | 2019-05-15 16:22:24 +0100 | |
|---|---|---|
| committer | 2019-05-15 21:06:09 +0100 | |
| commit | 03d3563ef95efc6ab8076d66ebda48545c6089c4 (patch) | |
| tree | 0160e0a3b333a000c7c880d9373b46cfa3968e79 /include/configreader.h | |
| parent | Merge branch 'insp3' into master. (diff) | |
Replace socketengine_{pthread,win32} with C++11 threads.
Diffstat (limited to 'include/configreader.h')
| -rw-r--r-- | include/configreader.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/include/configreader.h b/include/configreader.h index f9b9b582b..a7105ea7f 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -461,24 +461,35 @@ class CoreExport ServerConfig */ class CoreExport ConfigReaderThread : public Thread { - ServerConfig* Config; - volatile bool done; + private: + /** The new server configuration. */ + ServerConfig* Config = new ServerConfig(); + + /** Whether the config has been read yet. */ + std::atomic_bool done = { false }; + + protected: + /** @copydoc Thread::OnStart */ + void OnStart() override; + + /** @copydoc Thread::OnStop */ + void OnStop() override; + public: - const std::string TheUserUID; - ConfigReaderThread(const std::string &useruid) - : Config(new ServerConfig), done(false), TheUserUID(useruid) + const std::string UUID; + + ConfigReaderThread(const std::string& uuid) + : UUID(uuid) { } - virtual ~ConfigReaderThread() + ~ConfigReaderThread() { delete Config; } - void Run() override; - /** Run in the main thread to apply the configuration */ - void Finish(); - bool IsDone() { return done; } + /** Whether the configuration has been read yet. */ + bool IsDone() { return done.load(); } }; class CoreExport ConfigStatus |
