|
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-09-05 02:26:21
Hi Roland,
--- Roland Schwarz <roland.schwarz_at_[hidden]> wrote:
> Me for my part always ended with some kind of reference counting.
> This btw. is
> what WSAStartup/Cleanup seemingly is doing inside. But I think you
> could simply
> move the ref-counting into your code to be independant of WSAStartups
> peculiarities. E.g. you could simply wrap up things into a
shared_ptr.
I have been thinking about this today, and that is also what I have
decided to do.
> Not sure if I understand this correctly. You are using ::TLSFree
> don't you?
Yes, but...
> Besides how about
> boost::thread_specific_ptr<bool> pbool;
> pbool.reset(new bool); ?
the boost tss stuff seems to include a lot of code to ensure that the
newed bool is deleted at the appropriate time. This is unnecessary when
I just want to store a boolean value - i.e. I just store a null-pointer
to mean false, a non-null pointer to mean true.
In the change I'm planning to make it use one tss slot for all
demuxers, I still do not need any cleanup, since i will simply be
storing pointers to stack-based objects in tss.
> I know this might seem a little ignorant, but could you please give
> me your rationale for "header only" ?
It's very simple, and mostly non-technical: I see having a compiled
library as an entry barrier to people using my library. I want to make
it as easy as possible for people to get started and use.
A compiled library means something has to be built before developers
can get started developing. Sometimes this means waiting for a very
long build to complete when you only want to use a small part of the
library. Sometimes the build step is a potential source of errors for
the user if they don't follow the instructions correctly, and therefore
results in support emails that have to be answered. You also have to
support building in all the common configurations (I realise
Boost.Build does this for you). And this build step is required every
time you release a new version.
With a header file library, the steps to start using it are very
simple:
- Is your compiler/platform supported? if so..
- Download the library and unpack it
- Add it to your include path
- Start coding
:)
(Obviously it helps if the library is predominantly template-based, and
if you want to be able to inline most OS calls for performance
reasons.)
Cheers,
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk