diff options
Diffstat (limited to 'win/rfb_win32/RegConfig.cxx')
-rw-r--r-- | win/rfb_win32/RegConfig.cxx | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/win/rfb_win32/RegConfig.cxx b/win/rfb_win32/RegConfig.cxx index d9835201..057882b9 100644 --- a/win/rfb_win32/RegConfig.cxx +++ b/win/rfb_win32/RegConfig.cxx @@ -24,15 +24,17 @@ #include <malloc.h> +#include <core/LogWriter.h> + #include <rfb_win32/RegConfig.h> -#include <rfb/LogWriter.h> + //#include <rdr/HexOutStream.h> using namespace rfb; using namespace rfb::win32; -static LogWriter vlog("RegConfig"); +static core::LogWriter vlog("RegConfig"); RegConfig::RegConfig(EventManager* em) @@ -66,10 +68,10 @@ void RegConfig::loadRegistryConfig(RegKey& key) { const char *name = key.getValueName(i++); if (!name) break; std::string value = key.getRepresentation(name); - if (!Configuration::setParam(name, value.c_str())) + if (!core::Configuration::setParam(name, value.c_str())) vlog.info("Unable to process %s", name); } - } catch (rdr::win32_error& e) { + } catch (core::win32_error& e) { if (e.err != ERROR_INVALID_HANDLE) vlog.error("%s", e.what()); } @@ -91,17 +93,21 @@ void RegConfig::processEvent(HANDLE /*event*/) { } -RegConfigThread::RegConfigThread() : config(&eventMgr), thread_id(-1) { +RegConfigThread::RegConfigThread() : config(&eventMgr), thread(nullptr), + thread_id(-1) { } RegConfigThread::~RegConfigThread() { PostThreadMessage(thread_id, WM_QUIT, 0, 0); - wait(); + if (thread != nullptr) { + thread->join(); + delete thread; + } } bool RegConfigThread::start(const HKEY rootKey, const char* keyname) { if (config.setKey(rootKey, keyname)) { - Thread::start(); + thread = new std::thread(&RegConfigThread::worker, this); while (thread_id == (DWORD)-1) Sleep(0); return true; @@ -115,5 +121,5 @@ void RegConfigThread::worker() { thread_id = GetCurrentThreadId(); while ((result = eventMgr.getMessage(&msg, nullptr, 0, 0)) > 0) {} if (result < 0) - throw rdr::win32_error("RegConfigThread failed", GetLastError()); + throw core::win32_error("RegConfigThread failed", GetLastError()); } |