
1 Mar
2009
1 Mar
'09
7:35 p.m.
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.