Boost logo

Boost :

From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2007-12-20 19:15:19


Eames, Andrew wrote:
> I've been looking at Boost.Thread and it seems that it
> relies on one of a fixed few threading libraries to exist. I have my own
> native implementation of mutexes etc. and it doesn't seem like there is
> any easy way to plug it in without editing a lot of the boost source.

Hi Andrew,

I have also written a few of my own mutex and thread classes. What
sort of integration do you want between your mutexes (etc) and the
Boost code? Some of the things that occurred to me were:

- Make boost::mutex (etc) actually use your code on your platform; I
think this requires that you augment the Boost code with an additional
set of #if blocks. You might prefer to just write your own classes
with interfaces compatible with the Boost ones and select them by means
of "using namespace".

- Make your classes inter-operate with the Boost classes (e.g. using
your mutex with the Boost lock or condition class); this is more
possible with the newer Boost and proposed std:: classes, but you'll
find some issues e.g. std::condition_var_any looks as if it can work
with a mutex that you provide, but actually it still relies on its own
default mutex (e.g. POSIX) being available internally.

- Make your classes inter-operate with thread cancellation /
interruption. This is only an issue if you have any sort of
cancellation in the first place, of course....

- Make other bits of Boost use your classes (e.g. the shared_ptr atomic
reference count). I think that this also requires that you add a set
of #if blocks in each case.

Is there anything else that you have in mind?

Phil.


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