|
Boost : |
From: williamkempf_at_[hidden]
Date: 2001-03-19 16:32:40
--- In boost_at_y..., "Greg Colvin" <gcolvin_at_u...> wrote:
> From: <williamkempf_at_h...>
> > ...
> >
> > For CloseHandle this is very true. However, this discussion
started
> > with the checks made for misuse of the lock types (such as
multiple
> > lock attempts). It seems to me that this is still a gray area.
Some
> > seem to think it should be an exception, others an assertion
(with
> > the ability to leave it "on" during release/production builds).
>
> How expensive are the checks in this case?
The checks for misuse in the lock types are trivial. The check for
misuse in boost::mutex results in slightly more complexity, though
the performance is still very good and you have the option of using
the unchecked boost::fast_mutex most of the time (depending on the
lock types needed). There's valid debate over whether or not the
checks in boost::mutex are appropriate. Posix Threads will soon
offer the developer the ability to choose whether or not a mutex uses
Checked locking policies just to illustrate that others have found
this a hard question to anser. I opted for the paranoid checking
because I place safety above all else, but it may be that an
unchecked policy (actually, unspecified, since the underlying API may
do checking) or even an option to select which policy at compile time
via a template parameter would be a better answer.
The more advanced deadlock detection checks would be quite expensive
so will need to be optional in some fashion. I figure this part of
the library will be addressed in Phase 3 or Phase 4.
Bill Kempf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk