$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Glen Knowles (gknowles_at_[hidden])
Date: 2004-07-10 16:48:25
> From: Howard Hinnant [mailto:hinnant_at_[hidden]]
> On Jul 9, 2004, at 11:00 PM, Glen Knowles wrote:
>
> >> <nod> I just implemented lock_both::lock two ways: Once
> just keep
> >> try-locking both ways, and once locking in the order of
> the addresses
> >> of the locks (with only two locks in the test, this was a safe
> >> operator<). My test looks like:
> >
> > The problem case for spinning is when one thread gets the locks and
> > the holds them for a non-trivial length of time. During
> that time the
> > other, spinning thread, just wastes cpu as fast as it can.
> This just
> > gets magnified as more threads are involved.
>
> You are describing a spin-lock, but not lock_both (except for
> a theoretical and unlikely scenario).
Yes, I didn't think it through all the way.
Glen