
----- Original Message ----- From: "Chad Nelson" <chad.thecomfychair@gmail.com> To: <boost@lists.boost.org> Sent: Sunday, May 02, 2010 12:01 AM Subject: Re: [boost] [xint] Third release is ready, requesting preliminary review
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 05/01/2010 02:52 PM, vicente.botet wrote:
I'm confused... what is the difference between having two separate libraries and having a compile-time option? The compile-time option leads directly to having two separate compiled versions of the library.
You have misunderstood my concern. I mean to have a library xint and a library xint_ts (thread safe), as we have have now signals and signals2. This provides two libraries with different features can can leave on the same executable.
User that don't need the xint_ts dont have to link with lib thread. Of course, xint_ts can use anything xint provides, but not the oposit.
Just an idea, that solves a lot of issue taking in account the different user expectations.
The thread-safe version would be different from the single-thread version in only two tiny pieces of code (one for a shared resource, one that turns off the copy-on-write stuff). Is that enough to really justify a separate library?
Good new, if the differences are minor, you will take advantage from more common code. Well, you can add a template traits class to the xint::integer class that do whatever is differennt between both versions namespace xint { template <typename IntegerThreadingTraits = integer_single_threading_traits> class interger; } class integer will use this trait class whenever there is a specificity. WHat is expected from the IntegerThreadingTraits class is up to you and depend on the differences. Then you can define the class xint_ts::integer in a separated file as #include <boost/xint/integer_multi_threading_traits.hpp> namespace xint_ts { typedef xint::integer<integer_multi_threading_traits> interger; } This file will depend indirectly on Boost.Thread via integer_multi_threading_traits. Let me know if you need more details. Best, Vicente