From: Levente Farkas (lfarkas_at_[hidden])
Date: 2000-09-14 10:36:41


William Kempf wrote:
>
> --- In boost_at_[hidden], Levente Farkas <lfarkas_at_m...> wrote:
> > William Kempf wrote:
> > > > create the lock on the heap can't help here.
> > >
> > > And why not?
> >
> > since you can't protect a.next() in that way.
>
> Why not?
{
  boost::lock* lock = new boost::lock(m);
  for (int i = a.get(); i < 100; a.next())
  {
    <some code>
    delete lock;
    f();
    lock = new boost::lock(m);
    <some code>
  }
  delete lock;
}

since you can do it just the following way, but this code create 100 lock
(for safety:-()

ps. anyway I can agree with csaba, if we don't have lock/unlock on mutex at
least we need it on lock (yes this is the unsafe_lock and we loose compile
time check and...almost everything safe, but the exception safety).

 -- Levente
 "The only thing worse than not knowing the truth is
  ruining the bliss of ignorance."