Boost logo

Boost Users :

From: C. Michailidis (dinom_at_[hidden])
Date: 2005-04-07 07:32:39


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!

My problem is that I have existing code which I would like to make more
portable by using Boost.Threads. Now, this wouldn't be a problem except for
the fact that I'm (effectively) dealing w/ a COM object that already has its
interface defined.

There must be millions of lines of code which won't be able to get a minor
face-lift because "lock and unlock functions are not exposed". Since when is
ensuring safe usage more important than providing common functionality?

Ugh,
Dino


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