Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/util_thread.cpp')
-rw-r--r--intern/cycles/util/util_thread.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/intern/cycles/util/util_thread.cpp b/intern/cycles/util/util_thread.cpp
index 3db8b4bd197..c66aa484264 100644
--- a/intern/cycles/util/util_thread.cpp
+++ b/intern/cycles/util/util_thread.cpp
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#include "util_thread.h"
+#include "util/util_thread.h"
-#include "util_system.h"
-#include "util_windows.h"
+#include "util/util_system.h"
+#include "util/util_windows.h"
CCL_NAMESPACE_BEGIN
@@ -26,7 +26,11 @@ thread::thread(function<void(void)> run_cb, int group)
joined_(false),
group_(group)
{
+#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
+ thread_ = std::thread(&thread::run, this);
+#else
pthread_create(&pthread_id_, NULL, run, (void*)this);
+#endif
}
thread::~thread()
@@ -60,7 +64,17 @@ void *thread::run(void *arg)
bool thread::join()
{
joined_ = true;
+#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
+ try {
+ thread_.join();
+ return true;
+ }
+ catch (const std::system_error&) {
+ return false;
+ }
+#else
return pthread_join(pthread_id_, NULL) == 0;
+#endif
}
CCL_NAMESPACE_END