summaryrefslogtreecommitdiff
path: root/contrib/libc++/src/thread.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-08 19:39:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-08 19:39:03 +0000
commitaed8d94e97d1be8b4e26ce1ffb4d0547aee8ab1d (patch)
treef4b32ab9e34cda2eead99ae084f0b02d0dab6891 /contrib/libc++/src/thread.cpp
parent657db61c2068b2bcc0d930546402284e2c9c9abd (diff)
parent4a2db4d30e1653093d4d8b06e8221e2f8b723507 (diff)
Notes
Diffstat (limited to 'contrib/libc++/src/thread.cpp')
-rw-r--r--contrib/libc++/src/thread.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/contrib/libc++/src/thread.cpp b/contrib/libc++/src/thread.cpp
index 467402b6b423a..4fb1dd21fc2c7 100644
--- a/contrib/libc++/src/thread.cpp
+++ b/contrib/libc++/src/thread.cpp
@@ -24,16 +24,17 @@
# endif // defined(BSD)
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-#if !defined(_WIN32)
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
# include <unistd.h>
-#endif // !_WIN32
+#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if defined(__NetBSD__)
#pragma weak pthread_create // Do not create libpthread dependency
#endif
-#if defined(_WIN32)
+
+#if defined(_LIBCPP_WIN32API)
#include <windows.h>
-#endif
+#endif // defined(_LIBCPP_WIN32API)
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -53,10 +54,9 @@ thread::join()
if (ec == 0)
__t_ = 0;
}
-#ifndef _LIBCPP_NO_EXCEPTIONS
+
if (ec)
- throw system_error(error_code(ec, system_category()), "thread::join failed");
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_system_error(ec, "thread::join failed");
}
void
@@ -69,10 +69,9 @@ thread::detach()
if (ec == 0)
__t_ = 0;
}
-#ifndef _LIBCPP_NO_EXCEPTIONS
+
if (ec)
- throw system_error(error_code(ec, system_category()), "thread::detach failed");
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_system_error(ec, "thread::detach failed");
}
unsigned
@@ -93,7 +92,7 @@ thread::hardware_concurrency() _NOEXCEPT
if (result < 0)
return 0;
return static_cast<unsigned>(result);
-#elif defined(_WIN32)
+#elif defined(_LIBCPP_WIN32API)
SYSTEM_INFO info;
GetSystemInfo(&info);
return info.dwNumberOfProcessors;