Re: waiting for another thread without blocking resources...
On Feb 14, 3:38 pm, Cholo Lennon <chololen...@hotmail.com> wrote:
On Feb 14, 11:42 am, Lars Uffmann <a...@nurfuerspam.de> wrote:
Cholo Lennon wrote:
If you are using boost, just call 'join':
Thank you, now I got the problem that join() never returns,
instead my application crashes - AFTER the last line of code
in the thread of execution, and before the line following
the join statement in the calling event procedure... Someone
doesn't like me here.
AFAIK 2 possibilities:
1- Your thread signaling is not working (it seems that it's not your
situation, but...).
2- Your thread is not 'joinable'. Threads are joinable if they
are built with a ctor functor parameter (you will get an
assert calling 'join' on a non-joinable thread)
More correctly: a "thread" is joinable as long as the
boost::thread object which started it has not been destructed,
and can only be joined on that particular object. Certainly not
the best design around, but usable if you're careful. If you
plan on joining, it's probably best to wrap the boost::thread in
a class of your own, which inhibits copy and assignment, and
asserts that join has been called in the destructor. (For a
detached thread, you just wrap it in a function, which creates
the boost::thread object on the stack, and returns once the
thread has started.)
What's worse, the news portal to the boost mailing list
causes my thunderbird to create a severe error message upon
attempting to post...
Does anyone happen to have a link to a good boost
documentatin?http://boost.org/libs/libraries.htmdoesn'tquite
cut it...
The boost thread documentation is not the best (lacks of basic
examples).
The boost thread documentation presupposes that you understand
threading in general; it documents the interfaces provided by
boost, but not the theory of how to write and organize threaded
code in general.
For that, you'd need a book. (The Butenhof is a good starting
point.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34