From 7ec968e27210515c3f811c21b14becf9b18959ae Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Wed, 20 Aug 2014 17:34:54 +0200 Subject: [PATCH] Use bool instead of void as return type in packaged_task. MSVC can not handle void as return type, so we use a dummy bool instead. Fixes #32. --- include/osmium/io/detail/read_thread.hpp | 3 ++- include/osmium/io/detail/write_thread.hpp | 3 ++- include/osmium/io/detail/xml_input_format.hpp | 3 ++- include/osmium/thread/checked_task.hpp | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/osmium/io/detail/read_thread.hpp b/include/osmium/io/detail/read_thread.hpp index 894d382f6..eb8461261 100644 --- a/include/osmium/io/detail/read_thread.hpp +++ b/include/osmium/io/detail/read_thread.hpp @@ -67,7 +67,7 @@ namespace osmium { m_done(done) { } - void operator()() { + bool operator()() { osmium::thread::set_thread_name("_osmium_input"); try { @@ -91,6 +91,7 @@ namespace osmium { m_queue.push(std::string()); throw; } + return true; } }; // class ReadThread diff --git a/include/osmium/io/detail/write_thread.hpp b/include/osmium/io/detail/write_thread.hpp index 5b47b45cf..599851f0c 100644 --- a/include/osmium/io/detail/write_thread.hpp +++ b/include/osmium/io/detail/write_thread.hpp @@ -60,7 +60,7 @@ namespace osmium { m_compressor(compressor) { } - void operator()() { + bool operator()() { osmium::thread::set_thread_name("_osmium_output"); std::future data_future; @@ -72,6 +72,7 @@ namespace osmium { } while (!data.empty()); m_compressor->close(); + return true; } }; // class WriteThread diff --git a/include/osmium/io/detail/xml_input_format.hpp b/include/osmium/io/detail/xml_input_format.hpp index 7cd41da55..a328502c4 100644 --- a/include/osmium/io/detail/xml_input_format.hpp +++ b/include/osmium/io/detail/xml_input_format.hpp @@ -200,7 +200,7 @@ namespace osmium { m_done(done) { } - void operator()() { + bool operator()() { XML_Parser parser = XML_ParserCreate(nullptr); if (!parser) { throw osmium::io_error("Internal error: Can not create parser"); @@ -240,6 +240,7 @@ namespace osmium { // intentionally left blank } XML_ParserFree(parser); + return true; } private: diff --git a/include/osmium/thread/checked_task.hpp b/include/osmium/thread/checked_task.hpp index ee6fc8257..75c664c99 100644 --- a/include/osmium/thread/checked_task.hpp +++ b/include/osmium/thread/checked_task.hpp @@ -46,13 +46,13 @@ namespace osmium { class CheckedTask { std::thread m_thread; - std::future m_future; + std::future m_future; public: template explicit CheckedTask(TArgs&&... args) { - std::packaged_task pack_task(T(std::forward(args)...)); + std::packaged_task pack_task(T(std::forward(args)...)); m_future = pack_task.get_future(); m_thread = std::thread(std::move(pack_task)); }