Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-08-24 12:10:57


From: "Alexander Terekhov" <terekhov_at_[hidden]>
> Peter Dimov wrote:
> [...]
> > 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);
[...]
> What's wrong with it (the need to communicate exception type
> lists to the "generic" code, aside please)?

Nothing (except that R cannot be a reference type.) Which is better depends
on typical use. With "R* join()", to use the return value, you have to check
first; with "R join()", you don't have to. It's like

double sqrt(double) throw(domain_error);

vs

double * sqrt(double); // NULL on error

(reentrancy issues aside.)


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