Boost logo

Boost Users :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-04-07 09:55:41


C. Michailidis wrote:
> Quoting from
> http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.mutexes
>
> "Many C++ threading libraries use a pattern known as Scoped
> Locking[SchmidtStalRohnertBuschmann] to free the programmer from the need to
> explicitly lock and unlock mutex objects. With this pattern, a Lock concept
> is employed where the lock object's constructor locks the associated mutex
> object and the destructor automatically does the unlocking. The Boost.Threads
> library takes this pattern to the extreme in that Lock concepts are the only
> way to lock and unlock a mutex object: lock and unlock functions are not
> exposed by any Boost.Threads mutex objects. This helps to ensure safe usage
> patterns, especially when code throws exceptions."
>
> Unfortunately, I actually WANT to shoot myself in the foot this time and
> Boost.Threads won't let me!!! I can understand ENCOURAGING users to write
> safe code, but forcing them to is outright fascist!

Read the above carefully... It doesn't say there aren't lock/unlock
calls. Only that mutexes don't provide them. You are free to shoot
yourself by manually locking and unlocking "Locks". Which will
lock/unlock the associated mutex.

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

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