|
Boost : |
From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2002-08-24 12:00:11
Peter Dimov wrote:
[...]
> (except thread_cancel, which is silently ignored.)
And thread_exit too.
[...]
> A non-void return R implies intent to call "R join()"
Nah, my intent [including "void R", and accessing thread object via
"joinable_thread_ptr< R{[, thread]-and/or-[, ...exceptions...]} >"
smart pointer (in addition to thread_ptr<> and current_thread_ptr<>
"smarties")]:
A) R* join()
thread::canceled( jtp->join() ) would yield TRUE if
thread was canceled, otherwise result pointer can be
safely derefenced ("void R" aside);
B) R* tryjoin()
thread::busy( jtp->tryjoin() ) would yield TRUE if
thread was still running,
thread::canceled( jtp->tryjoin() ) would yield TRUE
if thread was canceled, otherwise ("busy" case aside)
result pointer can be safely deferenced ("void R"
aside);
C) R* timedjoin(/*timeout*/)
thread::timedout( jtp->timedjoin(/*timeout*/) ) would
yield TRUE if thread was still running by the time of
timeout expiration,
thread::canceled( jtp->timedjoin(/*timeout*/) ) would
yield TRUE if thread was canceled, otherwise ("timedout"
case aside) result pointer can be safely deferenced
("void R" aside).
What's wrong with it (the need to communicate exception type
lists to the "generic" code, aside please)?
> to obtain the thread
> function return value. Threads that are not to be joined should not use
> non-void returns.
Why? Well, I guess, you've NEVER "seen" code like this:
return_value function();
.
.
.
function(); // just ignore return value ;-)
regards,
alexander.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk