|
Boost : |
From: Evan Pfeuffer (evan_pfeuffer_at_[hidden])
Date: 2001-07-18 10:32:40
where can i find the threads library on the boost.org
website?
thanks in advance,
evan.
--- Alexander Terekhov <terekhov_at_[hidden]> wrote:
>
> > class X {
> > public:
> > mutable boost::mutex mtx;
> > int a;
> > X() : a(0) { }
> > X(const X& other) : a(0) { boost::mutex::lock
> lock(other.mtx); a =
> other.a; }
> > ~X() { }
> > };
>
> IMHO the use of "lock" is really confusing here.
> i would suggest to adopt more common "locker" or
> "guard"..
>
> class X {
> public:
> mutable boost::mutex mtxLock; // mutex is exclusive
> lock which does not
> support
> // transfer of lock
> ownership. binary
> semaphore is
> // exclusive lock which
> does support
> transfer of
> // lock ownership.
> int a;
> X() : a(0) { }
> X(const X& other) : a(0) { boost::mutex::locker
> locker(other.mtxLock);
> a = other.a; }
> ~X() { }
> };
>
> or
>
> class X {
> public:
> mutable boost::mutex mtxLock; // mutex is exclusive
> lock which does not
> support
> // transfer of lock
> ownership. binary
> semaphore is
> // exclusive lock which
> does support
> transfer of
> // lock ownership.
> int a;
> X() : a(0) { }
> X(const X& other) : a(0) { boost::mutex::guard
> guard(other.mtxLock); a
> = other.a; }
> ~X() { }
> };
>
> --
>
> class Y {
> public:
> mutable boost::semaphore semLock;
> int a;
> Y() : a(0) { }
> Y(const X& other) : a(0) { boost::semaphore::guard
> guard(other.semLock); a = other.a; }
> ~Y() { }
> };
>
> regards,
> alexander.
>
>
>
>
> Info: http://www.boost.org Unsubscribe:
> <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
=====
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk