Boost logo

Boost Users :

From: Pierre THIERRY (nowhere.man_at_[hidden])
Date: 2006-06-20 05:32:52


Le Sat, 10 Jun 2006 00:51:28 -0300, Bruno Martínez a écrit :
> You can protext the lock with another, short-lived, lock:
>
> mutex m1;
> mutex m2;
> mutex::lock g_lk(m2, false);
>
> lib_lock()
> {
> mutex::lock lk(m1);
> g_lk.lock();
> }
>
> lib_unlock()
> {
> mutex::lock lk(m1);
> g_lk.unlock();
> }
>
> This isn't 100% OK because the lock is used from different threads, but
> should work.

As I'm new myself to MT programming, why isn't this 100% OK? I can't see
how it could fail.

Curiously,
Nowhere man

-- 
nowhere.man_at_[hidden]
OpenPGP 0xD9D50D8A

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net