2013-03-28 16 views
0

我想知道std::thread::join是在libcxx中實現的。雖然它在<thread>標題中聲明,但似乎沒有定義。我甚至看過libcxxabi,但在那裏也找不到它。在libcxx中實現的std :: thread :: join在哪裏

那麼有人可能會指出它在哪裏實施?

+0

並非所有的功能在頭文件中定義,他們可能會在鏈接時庫來實現。 – 2013-03-28 10:14:27

+4

src/thread.cpp在一開始。 – inf 2013-03-28 10:17:53

+0

@bamboon,謝謝。期待它在標題中。 – abergmeier 2013-03-28 10:25:19

回答

2

它在src/thread.cpp,靠近頂部:

void 
thread::join() 
{ 
    int ec = pthread_join(__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; 
}