1bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===------------------------- thread.cpp----------------------------------===//
2bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
3f5256e16dfc425c1d466f6308d4026d529ce9e0bHoward Hinnant//                     The LLVM Compiler Infrastructure
4bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
7bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
8bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===//
9bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
108d86b2e6867297fb2109824c67c50de67f3a31f2Jonathan Roelofs#include "__config"
118d86b2e6867297fb2109824c67c50de67f3a31f2Jonathan Roelofs#ifndef _LIBCPP_HAS_NO_THREADS
128d86b2e6867297fb2109824c67c50de67f3a31f2Jonathan Roelofs
13bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include "thread"
14bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include "exception"
1547499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant#include "vector"
1647499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant#include "future"
17cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant#include "limits"
180bfe8809b4805696036c5801f06a652402088505Howard Hinnant#include <sys/types.h>
19a22d2addb1287a7642bfcb211ae2cb21890d1cbdMarshall Clow#if !defined(_WIN32)
2021876f739e97c78816745f2cfb177b3c5a76fff0Ed Schouten# if !defined(__sun__) && !defined(__linux__) && !defined(_AIX) && !defined(__native_client__) && !defined(__CloudABI__)
2193cfd7fc4e4e3b9b4ca18abdef49b395f8277e42JF Bastien#   include <sys/sysctl.h>
2221876f739e97c78816745f2cfb177b3c5a76fff0Ed Schouten# endif // !defined(__sun__) && !defined(__linux__) && !defined(_AIX) && !defined(__native_client__) && !defined(__CloudABI__)
2393cfd7fc4e4e3b9b4ca18abdef49b395f8277e42JF Bastien# include <unistd.h>
24403f91ad2cb76585f336faaab4812ff3ac5d27deHoward Hinnant#endif // !_WIN32
25bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
2667444034ed83f5b27d66b082ec88f9d859b85cbaJoerg Sonnenberger#if defined(__NetBSD__)
2767444034ed83f5b27d66b082ec88f9d859b85cbaJoerg Sonnenberger#pragma weak pthread_create // Do not create libpthread dependency
2867444034ed83f5b27d66b082ec88f9d859b85cbaJoerg Sonnenberger#endif
29725ae713f2fc5fa41ab8004f4f707117d6f70d51Howard Hinnant#if defined(_WIN32)
30725ae713f2fc5fa41ab8004f4f707117d6f70d51Howard Hinnant#include <windows.h>
31725ae713f2fc5fa41ab8004f4f707117d6f70d51Howard Hinnant#endif
3267444034ed83f5b27d66b082ec88f9d859b85cbaJoerg Sonnenberger
33bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant_LIBCPP_BEGIN_NAMESPACE_STD
34bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
35bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantthread::~thread()
36bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
37adff4895b2746f30b271bc219713e7ded5ae9677Howard Hinnant    if (__t_ != 0)
38bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        terminate();
39bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}
40bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
41bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantvoid
42bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantthread::join()
43bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
44bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    int ec = pthread_join(__t_, 0);
45d444470d6cd1cad554139c4ba7f3c4f3fe921a5dHoward Hinnant#ifndef _LIBCPP_NO_EXCEPTIONS
46bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    if (ec)
47bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        throw system_error(error_code(ec, system_category()), "thread::join failed");
48db4d478ff421cd1b1be254264367ceceebf39481Howard Hinnant#else
49db4d478ff421cd1b1be254264367ceceebf39481Howard Hinnant    (void)ec;
5016e6e1d72fd6a10fc165eba4ca4ed2fa7c45df78Howard Hinnant#endif  // _LIBCPP_NO_EXCEPTIONS
51adff4895b2746f30b271bc219713e7ded5ae9677Howard Hinnant    __t_ = 0;
52bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}
53bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
54bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantvoid
55bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantthread::detach()
56bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
57bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    int ec = EINVAL;
58bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    if (__t_ != 0)
59bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    {
60bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        ec = pthread_detach(__t_);
61bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        if (ec == 0)
62bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant            __t_ = 0;
63bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    }
64d444470d6cd1cad554139c4ba7f3c4f3fe921a5dHoward Hinnant#ifndef _LIBCPP_NO_EXCEPTIONS
65bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    if (ec)
66bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        throw system_error(error_code(ec, system_category()), "thread::detach failed");
6716e6e1d72fd6a10fc165eba4ca4ed2fa7c45df78Howard Hinnant#endif  // _LIBCPP_NO_EXCEPTIONS
68bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}
69bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
70bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantunsigned
716e1d851be868839fa0ce3fecbd7edeeac82a074fHoward Hinnantthread::hardware_concurrency() _NOEXCEPT
72bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
73adff4895b2746f30b271bc219713e7ded5ae9677Howard Hinnant#if defined(CTL_HW) && defined(HW_NCPU)
74ec3773c2dadbeadfc5def927116c2ee9d9c53066Howard Hinnant    unsigned n;
75bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    int mib[2] = {CTL_HW, HW_NCPU};
76bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    std::size_t s = sizeof(n);
77bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    sysctl(mib, 2, &n, &s, 0, 0);
78bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    return n;
79312926eed409beb23ef96bbca9642e27961ce27aHoward Hinnant#elif defined(_SC_NPROCESSORS_ONLN)
80403f91ad2cb76585f336faaab4812ff3ac5d27deHoward Hinnant    long result = sysconf(_SC_NPROCESSORS_ONLN);
815f767b7b28b28a1cd1d9950e3dd4b7bedf555d02Howard Hinnant    // sysconf returns -1 if the name is invalid, the option does not exist or
825f767b7b28b28a1cd1d9950e3dd4b7bedf555d02Howard Hinnant    // does not have a definite limit.
83b18165e704640ab7c4e2798529e0829bfbd29c3cMarshall Clow    // if sysconf returns some other negative number, we have no idea
84b18165e704640ab7c4e2798529e0829bfbd29c3cMarshall Clow    // what is going on. Default to something safe.
85b18165e704640ab7c4e2798529e0829bfbd29c3cMarshall Clow    if (result < 0)
865f767b7b28b28a1cd1d9950e3dd4b7bedf555d02Howard Hinnant        return 0;
87d854ce6bfaa35c4079872dc68ba18ac1fe7f49e2Marshall Clow    return static_cast<unsigned>(result);
88725ae713f2fc5fa41ab8004f4f707117d6f70d51Howard Hinnant#elif defined(_WIN32)
89725ae713f2fc5fa41ab8004f4f707117d6f70d51Howard Hinnant    SYSTEM_INFO info;
90725ae713f2fc5fa41ab8004f4f707117d6f70d51Howard Hinnant    GetSystemInfo(&info);
91725ae713f2fc5fa41ab8004f4f707117d6f70d51Howard Hinnant    return info.dwNumberOfProcessors;
9216e6e1d72fd6a10fc165eba4ca4ed2fa7c45df78Howard Hinnant#else  // defined(CTL_HW) && defined(HW_NCPU)
93adff4895b2746f30b271bc219713e7ded5ae9677Howard Hinnant    // TODO: grovel through /proc or check cpuid on x86 and similar
94adff4895b2746f30b271bc219713e7ded5ae9677Howard Hinnant    // instructions on other architectures.
95f7555069ab8b7eaf73970a1d325a51bedf2cb250Howard Hinnant#   if defined(_MSC_VER) && ! defined(__clang__)
96f7555069ab8b7eaf73970a1d325a51bedf2cb250Howard Hinnant        _LIBCPP_WARNING("hardware_concurrency not yet implemented")
97f7555069ab8b7eaf73970a1d325a51bedf2cb250Howard Hinnant#   else
98f7555069ab8b7eaf73970a1d325a51bedf2cb250Howard Hinnant#       warning hardware_concurrency not yet implemented
99f7555069ab8b7eaf73970a1d325a51bedf2cb250Howard Hinnant#   endif
100adff4895b2746f30b271bc219713e7ded5ae9677Howard Hinnant    return 0;  // Means not computable [thread.thread.static]
10116e6e1d72fd6a10fc165eba4ca4ed2fa7c45df78Howard Hinnant#endif  // defined(CTL_HW) && defined(HW_NCPU)
102bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}
103bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
104bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantnamespace this_thread
105bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
106bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
107bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantvoid
108bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantsleep_for(const chrono::nanoseconds& ns)
109bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
110bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    using namespace chrono;
111cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant    if (ns > nanoseconds::zero())
112bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    {
113cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        seconds s = duration_cast<seconds>(ns);
114bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        timespec ts;
115cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        typedef decltype(ts.tv_sec) ts_sec;
116cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        _LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
117cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        if (s.count() < ts_sec_max)
118cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        {
119cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant            ts.tv_sec = static_cast<ts_sec>(s.count());
120cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant            ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((ns-s).count());
121cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        }
122cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        else
123cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        {
124cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant            ts.tv_sec = ts_sec_max;
125cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant            ts.tv_nsec = giga::num - 1;
126cf115d2cc6bb658db58f4b0b7a2da078a18a62efHoward Hinnant        }
1270707b67ac33ee7584be43a2ed2902e61006813b7David Majnemer
1280707b67ac33ee7584be43a2ed2902e61006813b7David Majnemer        while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
1290707b67ac33ee7584be43a2ed2902e61006813b7David Majnemer            ;
130bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    }
131bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}
132bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
133bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}  // this_thread
134bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
1355306d68019dd52a3dc3989ff02958e3f21e9655cHoward Hinnant__thread_specific_ptr<__thread_struct>&
1365306d68019dd52a3dc3989ff02958e3f21e9655cHoward Hinnant__thread_local_data()
1375306d68019dd52a3dc3989ff02958e3f21e9655cHoward Hinnant{
1385306d68019dd52a3dc3989ff02958e3f21e9655cHoward Hinnant    static __thread_specific_ptr<__thread_struct> __p;
1395306d68019dd52a3dc3989ff02958e3f21e9655cHoward Hinnant    return __p;
1405306d68019dd52a3dc3989ff02958e3f21e9655cHoward Hinnant}
14147499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
14247499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant// __thread_struct_imp
14347499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
1442d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnanttemplate <class T>
1452d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnantclass _LIBCPP_HIDDEN __hidden_allocator
14647499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant{
1472d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnantpublic:
1482d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant    typedef T  value_type;
1492d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant
1502d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant    T* allocate(size_t __n)
1512d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant        {return static_cast<T*>(::operator new(__n * sizeof(T)));}
1524c6acb5ecd7fab26583353261fd52a9f7ba2f1e0Joerg Sonnenberger    void deallocate(T* __p, size_t) {::operator delete(static_cast<void*>(__p));}
1532d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant
1542d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant    size_t max_size() const {return size_t(~0) / sizeof(T);}
1552d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant};
1562d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant
1572d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnantclass _LIBCPP_HIDDEN __thread_struct_imp
1582d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant{
1592d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant    typedef vector<__assoc_sub_state*,
1602d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant                          __hidden_allocator<__assoc_sub_state*> > _AsyncStates;
1612d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant    typedef vector<pair<condition_variable*, mutex*>,
1622d72b1e393e35d61917d6d0ce069482ab11e96d1Howard Hinnant               __hidden_allocator<pair<condition_variable*, mutex*> > > _Notify;
163e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant
16447499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    _AsyncStates async_states_;
165e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant    _Notify notify_;
16647499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
16747499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    __thread_struct_imp(const __thread_struct_imp&);
16847499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    __thread_struct_imp& operator=(const __thread_struct_imp&);
16947499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnantpublic:
17047499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    __thread_struct_imp() {}
17147499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    ~__thread_struct_imp();
17247499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
173e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant    void notify_all_at_thread_exit(condition_variable* cv, mutex* m);
17447499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    void __make_ready_at_thread_exit(__assoc_sub_state* __s);
17547499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant};
17647499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
17747499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant__thread_struct_imp::~__thread_struct_imp()
17847499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant{
179e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant    for (_Notify::iterator i = notify_.begin(), e = notify_.end();
180e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant            i != e; ++i)
181e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant    {
182e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant        i->second->unlock();
183e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant        i->first->notify_all();
184e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant    }
18547499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    for (_AsyncStates::iterator i = async_states_.begin(), e = async_states_.end();
18647499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant            i != e; ++i)
18747499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    {
18847499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant        (*i)->__make_ready();
18947499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant        (*i)->__release_shared();
19047499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    }
19147499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant}
19247499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
19347499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnantvoid
194e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant__thread_struct_imp::notify_all_at_thread_exit(condition_variable* cv, mutex* m)
195e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant{
196e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant    notify_.push_back(pair<condition_variable*, mutex*>(cv, m));
197e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant}
198e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant
199e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnantvoid
20047499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant__thread_struct_imp::__make_ready_at_thread_exit(__assoc_sub_state* __s)
20147499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant{
20247499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    async_states_.push_back(__s);
20347499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    __s->__add_shared();
20447499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant}
20547499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
20647499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant// __thread_struct
20747499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
20847499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant__thread_struct::__thread_struct()
20947499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    : __p_(new __thread_struct_imp)
21047499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant{
21147499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant}
21247499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
21347499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant__thread_struct::~__thread_struct()
21447499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant{
21547499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    delete __p_;
21647499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant}
21747499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
21847499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnantvoid
219e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant__thread_struct::notify_all_at_thread_exit(condition_variable* cv, mutex* m)
220e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant{
221e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant    __p_->notify_all_at_thread_exit(cv, m);
222e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant}
223e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnant
224e6e4d015530014978920fa46cfe294518dc3490aHoward Hinnantvoid
22547499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant__thread_struct::__make_ready_at_thread_exit(__assoc_sub_state* __s)
22647499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant{
22747499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant    __p_->__make_ready_at_thread_exit(__s);
22847499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant}
22947499b162ae741a247e5f89b7bdb513e51c3648aHoward Hinnant
230bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant_LIBCPP_END_NAMESPACE_STD
2318d86b2e6867297fb2109824c67c50de67f3a31f2Jonathan Roelofs
2328d86b2e6867297fb2109824c67c50de67f3a31f2Jonathan Roelofs#endif // !_LIBCPP_HAS_NO_THREADS
233