summaryrefslogtreecommitdiff
path: root/zen/thread.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:23:19 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:23:19 +0200
commit0887aee8c54d0ed51bb2031431e2bcdafebb4c6e (patch)
tree69537ceb9787bb25ac363cc4e6cdaf0804d78363 /zen/thread.h
parent5.12 (diff)
downloadFreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.tar.gz
FreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.tar.bz2
FreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.zip
5.13
Diffstat (limited to 'zen/thread.h')
-rw-r--r--zen/thread.h19
1 files changed, 5 insertions, 14 deletions
diff --git a/zen/thread.h b/zen/thread.h
index 43917d13..ae865cc8 100644
--- a/zen/thread.h
+++ b/zen/thread.h
@@ -11,7 +11,7 @@
#include <memory>
//fix this pathetic boost thread warning mess
-#ifdef __MINGW32__
+#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -24,7 +24,7 @@
#include <boost/thread.hpp>
-#ifdef __MINGW32__
+#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
@@ -34,8 +34,8 @@
namespace zen
{
/*
-std::async replacement without crappy semantics:
- 1. guaranteed to run asynchronous
+std::async replacement without crappy semantics:
+ 1. guaranteed to run asynchronous
2. does not follow C++11 [futures.async], Paragraph 5, where std::future waits for thread in destructor
Example:
@@ -79,15 +79,6 @@ private:
-
-
-
-
-
-
-
-
-
//###################### implementation ######################
#ifndef BOOST_HAS_THREADS
#error just some paranoia check...
@@ -99,7 +90,7 @@ auto async2(Function fun) -> boost::unique_future<T> //support for workaround of
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK //mirror "boost/thread/future.hpp", hopefully they know what they're doing
boost::packaged_task<T()> pt(std::move(fun)); //packaged task seems to even require r-value reference: https://sourceforge.net/p/freefilesync/bugs/234/
#else
- boost::packaged_task<T> pt(std::move(fun));
+ boost::packaged_task<T> pt(std::move(fun));
#endif
auto fut = pt.get_future();
boost::thread(std::move(pt)).detach(); //we have to explicitly detach since C++11: [thread.thread.destr] ~thread() calls std::terminate() if joinable()!!!
bgstack15