summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/src/thread.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp
index 406e71d2ac6..467402b6b42 100644
--- a/libcxx/src/thread.cpp
+++ b/libcxx/src/thread.cpp
@@ -46,14 +46,17 @@ thread::~thread()
void
thread::join()
{
- int ec = __libcpp_thread_join(&__t_);
+ int ec = EINVAL;
+ if (__t_ != 0)
+ {
+ ec = __libcpp_thread_join(&__t_);
+ if (ec == 0)
+ __t_ = 0;
+ }
#ifndef _LIBCPP_NO_EXCEPTIONS
if (ec)
throw system_error(error_code(ec, system_category()), "thread::join failed");
-#else
- (void)ec;
#endif // _LIBCPP_NO_EXCEPTIONS
- __t_ = 0;
}
void
OpenPOWER on IntegriCloud