Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-09-07 10:34:20

----- Original Message -----
From: "Levente Farkas" <lfarkas_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, September 07, 2000 9:49 AM
Subject: Re: [boost] Re: Threads: New Win32 Implementation

> William Kempf wrote:
> > This is in the e-groups archive, as we've discussed it from the
> > beginning. Simply put, lock/unlock methods are dangerous to use,
> > especially with exceptions. If an "auto lock" class will do the same
> > thing more safely, and with the same performance, then we're better
> > off not exposing the lock/unlock functions at all.
> I didn't read the archive, but this is not true. it's one of the biggest
> problem in java thread (and that was one of the main reason that in this
> year on javaone at least 3 main session about "a new concurent library for
> java"), the syncronyzed keyword have to be around a block, auto-lock can't
> always do the same thing, ie. you can't do the following:
> Mutex m1, m2;
> m1.lock();
> <may be some code>
> m2.lock();
> <may be some code>
> m1.unlock();
> <may be some code>
> m2.unlock();

Sure you can. Consider std::auto_ptr<Mutex>, or if you're desperate for
performance, new (void*) Mutex ;)


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