
27 Mar
2007
27 Mar
'07
6:50 p.m.
Howard Hinnant wrote:
I'm beginning to think:
multijoin() const { // Don't want to pretend to join with non-existent // (or detached) thread, make noise if (handle_ == 0) throw ?; while (!tl->done) tl->cv1.wait(); }
join() { multijoin(); detach(); }
I think it should be more like: multijoin() const // try, timed same { if( handle_ != 0 ) // the NULL thread is considered terminated while (!tl->done) tl->cv1.wait(); } join() { if( handle_ == 0 ) assert, throw acc. to taste multijoin(); detach(); *this = std::thread(); } I still think that the user would be free to build destructive join/detach upon the provided interface and that we don't really have to provide them.