Boost logo

Boost :

From: Vygis D. (vygintas.daugmaudis_at_[hidden])
Date: 2003-10-24 15:39:09


> "Hurd, Matthew" <hurdm_at_[hidden]> writes:
> > A further note: The exception characteristics for a message queue are
> > particularly interesting. Normally, as per exceptional c++, you'd
separate
> > the top and pop part, or head and remove_head, for the reasons discussed
in
> > Sutter's book. However, in a threaded case, you want this as an atomic
op
> > and you have an exception problem AFAICT. Not sure what the answer is
here
> > with these competing concerns. Any thoughts?
>
> Have the queue return an object that locks the queue for the duration of
its
> existence, which contains functions for top and pop.

[snip]

I wrote an early draft of some facility which I called 'synchronized' (some
kind of equivalent to javaish synchronized), this facility does something
similar to Matthew's variant although I guess it's a bit more generic
(synchronized MessageQueue stack implementation would look as follows:
synchronized<std::stack>; some additional typedefs in synchronized_traits
and this can emulate true std::stack [this can be powerful in conjuction
with, for example, container_traits, I'm looking forward for this lib]).
Well, other details and draft code can be found at:

http://libcalc.sourceforge.net/synchronized.hpp

Unfortunately, my previous message just slipped unnoticed.

P.S.
class synchronized is still in 'experimental' namespace. This means it's not
yet finished but IMO it can be useful at its current state.

Regards,
Justinas V.D.


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