|
Boost-MPI : |
Subject: Re: [Boost-mpi] Thread API
From: Matthias Troyer (troyer_at_[hidden])
Date: 2012-11-29 08:21:09
On Nov 29, 2012, at 1:11 PM, Alain O Miniussi <alain.miniussi_at_oca.eu> wrote:
>
> That being said, I do not have a strong opinion between:
> a) provide a 2 argument ctor
> b) provide one argument ctor, and test provided level afterward.
>
> I just have a preference for b, because I find it simpler (both in terms
> of API and explanation, one thing I did not mention is that we could as
> weel abort if the requirement is not met in the ctor, since we won't be
> able to do any MPI related stuff after that, so going into a lot of
> trouble to explain the status of env seems unjustified), and that
> throwing in ctor has it's own set of issue (if only being
> controversial).
Actually throwing in the constructor if we cannot acquire a resource (here MPI with required level of thread support) is just the RAII idiom. There are no problems with that and it is actually good style.
>
> One thing to consider is that if the requirement is not met, we probably
> want to explain what's going on to the user. Which will require some
> code. So the test "if (provided < required) { ... }" won't add a lot of
> trouble anyway.
I agree. If the requested level is not met we will need to test anyway which level we got.
Matthias
Boost-Commit list run by troyer at boostpro.com