|
Boost : |
From: Eric Woodruff (Eric.Woodruff_at_[hidden])
Date: 2002-08-11 12:02:31
Bill,
Could it hypothetically be done portably if the end user was separated from
main () by an Application class? The body, or "main", of the application can
be started in a boost::thread.
----- Original Message -----
From: William Kempf
Newsgroups: gmane.comp.lib.boost.devel
Sent: Sunday, 2002:August:11 9:48 AM
Subject: Re: Re: Re: Threads & Exceptions
>From: "Victor A. Wagner, Jr." <vawjr_at_[hidden]>
>At Thursday 2002/08/08 07:49, you wrote:
>>----- Original Message -----
>>From: "Victor A. Wagner, Jr." <vawjr_at_[hidden]>
>> > The C++ standard is silent on the topic of thread(s)
>>
>>But not on the behavior of a program that has an exception thrown that
>>would
>>propogate out of main().
>
>I fail to see how an exception which is "started" by thread<whatever> can
>be considered "inside" of main. And if it IS, then clearly I should be
>able to write:
>catch(...)
>{
>}
>to process it
Being "started by thread<whatever>" has nothing to do with it.
void my_thread(boost::thread* pthread)
{
try
{
pthread->join();
}
catch(...)
{
cout << "main() threw an exception" << endl;
}
delete pthread;
}
int main()
{
boost::thread* main = new thread();
boost::thread thrd(boost::bind(&my_thread, main));
thread_exit(); // Yes, this is something that needs added to
// Boost.Threads, and will be.
throw "error!";
}
The above can't be done portably, AFAIK, and is likely to result in
termination instead of the expected passage in join().
Bill Kempf
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk