$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2005-03-23 12:50:18
Peter Dimov wrote:
> Vladimir Prus wrote:
> 
>> Peter Dimov wrote:
>>
>>> None (if you are sure that this is what assert does, of course -
>>> this is platform specific), except that the asserts should not fire.
>>> So spending time and effort to make something happen when the
>>> asserts fire is not productive.
>>
>>
>> I disagree. Here, two people report that they got assertion failures.
>> Good, but we have no idea why. If there were additional diagnostic,
>> we'd knew the exact system error which was reported.
> 
> 
> Hm.
> 
> Thorsten Froehlich reports that on Mac OS X pthread_join on a thread 
> that has completed returns EINVAL. He is given a lecture on 
> pthread_join. Nobody with Mac OS X access bothers to investigate, at 
> least not visibly.
<snip>
Well, if anyone would care to compile and run the following program on 
Mac OS X using pthreads, we can at least tell whether there is a 
consistent failure:
// BEGIN
#include <boost/bind.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
#include <iostream>
#include <ostream>
void my_sleep(int sec)
{
     boost::xtime stop;
     boost::xtime_get(&stop, boost::TIME_UTC);
     stop.sec += sec;
     boost::thread::sleep(stop);
}
void do_nothing() {}
int main()
{
     boost::thread thread1(do_nothing);
     my_sleep(1);
     std::cout << "Joining exited thread\n";
     thread1.join();
     boost::thread thread2(boost::bind(my_sleep, 5));
     std::cout << "Joining running thread\n";
     thread2.join();
}
// END
It works for me on Windows XP (compiled with VC++ 7.1) and Linux 2.6 
(compiled with g++ 3.3).
Ben.