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
> > the top and pop part, or head and remove_head, for the reasons discussed
> > Sutter's book. However, in a threaded case, you want this as an atomic
> > and you have an exception problem AFAICT. Not sure what the answer is
> > with these competing concerns. Any thoughts?
> Have the queue return an object that locks the queue for the duration of
> existence, which contains functions for top and pop.


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:

Unfortunately, my previous message just slipped unnoticed.

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

Justinas V.D.

Boost list run by bdawes at, gregod at, cpdaniel at, john at