Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-03-19 17:16:47


--- In boost_at_y..., Lie-Quan Lee <llee1_at_l...> wrote:
> At Mon, 19 Mar 2001 21:47:37 -0000,
> williamkempf_at_h... wrote:
> >
> > --- In boost_at_y..., "Mark Rodgers" <mark.rodgers_at_c...> wrote:
> > > From: "Lie-Quan Lee" <llee1_at_l...>
> > > > Would be better to have a traits to get the type of locks
like:
> > > > typedef typename lock_categories<mutex>::lock Guard;
> > > > typedef typename lock_categories<mutex>::trylock TryGuard;
> > > > typedef typename lock_categories<mutex>::timedlock
TimedGuard;
> > > >
> > > > I did a quick search in boost archive and did not see a
> > discussion on
> > > > that in both discussion phases(one was last summer, the other
is
> > since
> > > > last week). Maybe I missed it.
> > >
> > > I made a suggestion somewhat along those lines in
> > >
> > > http://groups.yahoo.com/group/boost/message/4409
> > >
> > > I think perhaps it is worth pursuing this topic.
> >
>
> It is interesting that Mark pointed the similarities between Mutexes
> and Containers and Locks and Iterators. I do not know if "TryLock
did
> actually refine Lock" is right way to go since I did not catch the
> semantic meaning yet.
>
> > A "lock_tag" might be useful. I'm not sure that full blown
traits
> > would be, at least with the types as defined today. Can you
> > illustrate how these concepts could be useful?
>
> I think that all general comments of using traits can be applied
> here. For exmaple, using "mutex::lock" put a stronger requirement on
> mutex type.

I'm probably being dense, but I don't see how. Could you please
illustrate with some code?

Bill Kempf


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