Boost logo

Boost :

From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-01-09 17:46:38


> From: "Peter Dimov" <pdimov_at_[hidden]>
> From: "William E. Kempf" <wekempf_at_[hidden]>
> > > From: "Peter Dimov" <pdimov_at_[hidden]>
> > > > (And is it useful to distinguish between memory and other resource
> > > errors?)
> > >
> > > This, I have no ready answer for... but "when in doubt, do what POSIX
> does."
> >
> > Why (in regards to "do what POSIX does")? They can make mistakes as
> easily
> > as the rest of us.
>
> Because they've had the time to find and correct their mistakes, I'd expect.
> :-)

Doesn't seem to apply, to me. If there's no reason to supply both but it had been standardized that way in the past, I'd expect they'd be loathe to change the standard, since having the seperation won't hurt. But that doesn't necessarily mean that if they had it to do over, they wouldn't simplify things by folding the error codes.
 
> > If we do seperate them, is there any reason to provide a thread specific
> memory
> > exception, or should we use std::bad_alloc?
>
> Good question. I'll face the same problem when I finally decide to fix the
> POSIX lightweight_mutex to check for error returns. :-) [As a side note, do
> you plan to integrate lightweight_mutex into Boost.Threads?]

Sort of. The theory was that boost::mutex should be a lightweight mutex, but that that's an implementation detail. So my plan was just to address the implementation when I had the time.
 
> I'm not sure which piece of information is more important here, the "no
> memory" part or the "this is a thread exception" part, although I'm leaning
> towards a std::bad_alloc derived exception (boost::posix_enomem?
> boost::thread::out_of_memory?)

Naming will drive me nuts here, but I don't like using "posix" when it's not POSIX specific.
 
> > > An error code (OS or portable) can be of help when one needs to catch
> all
> > > thread-related (or better yet, all error code providing) exceptions in a
> > > single catch clause. Usually this is only needed to report an error,
> though,
> > > so if thread exceptions provide some other common mechanism to identify
> the
> > > error (like specific what() values), carrying an error code won't be
> > > necessary.
> >
> > And would the above mentioned "localized message" be enough to satisfy
> this
> > requirement?
>
> I think that it would be enough for my needs. Can't speak for others.

Well, I'm addressing everyone :).

William E. Kempf
wekempf_at_[hidden]


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