Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2004-02-10 01:03:21


At Monday 2004-02-09 16:08, you wrote:

> > "Is everyone convinced that propagating the exception into the joining
> thread
>is the right behavior or even semantically sensible?"
>
>as a novice user of concurrent programming ( especially when compared to the
>level here in the boost list ), may i ask whether it is going to be
>possible to
>identify the throwing thread or not?
>
>here's why i am asking this: let's say i have two threads reading two
>different
>files and one of them throws ios_base::failure. this information by itself is
>meaningless if i catch it in the master thread as i don't have a way of
>identifying the source. currently, we employ a different mechanism ( using
>pthreads for now; wishing to switch to boost.threads ): each thread has
>its own
>error code in a shared container and if they want to report an error, they
>write
>to that container. that way, we know which thread is reporting what error and
>we can handle it. elegant? not at all but it works
>
>so i wonder if propagating exceptions from worker threads to the master thread
>is gonna have some comparable functionality? ( worker/master architecture
>is the
>only model we commonly use so i can't really talk for other thread
>architectures
>). if it doesn't, i think the best a programmer like myself can do is to
>catch
>( ... ) and then still use the shared error code container to resolve the
>issue
>
>am i misunderstanding this mechanism or is it gonna be like i described above?

I haven't looked at boost::thread closely at all, but I'd guessed that
"start_thread()" would have returned some sort of handle, and
"join(somehandle)" is how you do it. I believe this is sufficient for your
needs.

Now, I may be _completely_ wrong on how boost::threads works, I didn't
write it.

>burch
>
>
> > Stefan Seefeld <seefeld <at> sympatico.ca> writes:
> >
> > > Glen Knowles wrote:
> > >> From: David Abrahams [mailto:dave <at> boost-consulting.com]
> > >> >> Of course you cannot portably pass all exceptions, but you may
> be able
> > >> >> to pass all the ones that use standard types.
> > >> >
> > >> >And what if the std library or somebody else throws exceptions
> > >> >*derived* from the standard types?
> > >> If it is not a recognized corba exception what the ACE TAO does is
> > >> eat it with a catch(...) and then throws a corba system exception on
> > >> the other side.
> > >
> > >
> > > yes, so all exceptions that are allowed to pass have to be explicitely
> > > declared
> > > as such. If it is not declared, a special standard exception will be
> > > thrown (or may be something equivalent to 'unexpected'). If it is
> > > derived from a declared one, it will be sliced.
> >
> > Is everyone convinced that propagating the exception into the joining
> > thread is the right behavior or even semantically sensible?
>
>
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
The five most dangerous words in the English language:
               "There oughta be a law"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk