Refactor pthread usage of libcxx.

This patch extracts out all the pthread dependencies of libcxx into the
new header __threading_support. The motivation is to make it easy to
re-target libcxx into platforms that do not support pthread.

Original patch from Fulvio Esposito (fulvio.esposito@outlook.com) - D11781

Applied with tweaks - D19412

Change-Id: I301111f0075de93dd8129416e06babc195aa936b

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Asiri Rathnayake
2016-05-06 14:06:29 +00:00
parent 6637dc23f6
commit 35ff03b7c2
10 changed files with 299 additions and 105 deletions

View File

@@ -46,7 +46,7 @@ thread::~thread()
void
thread::join()
{
int ec = pthread_join(__t_, 0);
int ec = __libcpp_thread_join(&__t_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (ec)
throw system_error(error_code(ec, system_category()), "thread::join failed");
@@ -62,7 +62,7 @@ thread::detach()
int ec = EINVAL;
if (__t_ != 0)
{
ec = pthread_detach(__t_);
ec = __libcpp_thread_detach(&__t_);
if (ec == 0)
__t_ = 0;
}