On Jan 30, 6:36 pm, Howard Hinnant <howard.hinn...@gmail.comwrote:
Matt England <m...@downwithspammers-mengland.netwrote:
Wow, your post is most timely Matt. I'm most interested in what
features of Boost Threads you liked and disliked, the reasons for your
contemplating a move, and what features you are anticipating will solve
your problems with ZThread.
Howard Hinnant
Library Working Group Chairman, C++ Standards Committee- Hide quoted text -
The most obvious thing that jumps out to me is that ZThreads has more
pre-built high-level abstractions than Boost Threads (and a few more
low-level primitives too).
For example, ZThreads provides the following while Boost threads does
not:
- Thread pools (PoolExecutor)
- Semaphore class
- Atomic integer
While Boost threads' documentation mentions that the next phase will
include more high-level concepts, Boost threads doesn't seem to have
been updated in a 18 months.
The good things about both libraries is that they are written in C++
(as opposed to the pthreads library which is a C library). The thing
that bothers me with both ZThreads and Boost threads is that neither
support inter-process semaphores (or for that matter inter-process
threads) nor shared memory functionality. Windows threads API and
most implementations of pthreads (including those on Solaris, Linux
kernels 2.6 and later, Win32 implementation of pthreads) support
interprocess-semaphores. Windows and many POSIX implementations
support shared memory functionality. And as far as atomic operations
goes, ZThreads only seems to support atomic increment and decrement --
no atomic compare and swap functionality.
As far as naming goes and general class design, I prefer Boost
threads. The naming conventions is more in-line with the C++ standard
libraries and the rest of Boost. The general class design seems very
well thought out as well. (I wouldn't have implemented many of the
concepts in ZThreads differrently - why have a FastMutex class that
seems to have the same interface as the plain Mutex class?) I just
feel that Boost threads is too incomplete and that despite the promise
made in its documentation, it hasn't really been actively worked on in
a while.
So, a worthy question is what do I use in applications that I have to
write? I have resorted to writing my own cross-platform library that
focusses more on interprocess-primitives, shared memory, and atomic
operations as these are more important to the work that I do.
- Kevin Hall