$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] newbie thread synchronization question
From: Igor R (boost.lists_at_[hidden])
Date: 2009-03-01 14:35:56
>
> If I use it in from multiple threads with code that looks like:
> // s is an instance of Shared
> s.lock();
> int q = s.getQty();
> ++q;
> s.setQty(q);
> s.unlock();
>
It's correct locking, but if getQty/setQty throw, the object never gets
unlocked. So it's worth useing some RAII-style technique.