[cpp-threads] High-level concurrency issues

Peter Dimov pdimov at mmltd.net
Tue Oct 18 12:10:37 BST 2005


Herb Sutter wrote:

> Or call a virtual function, or use a template parameter, or let
> control flow through any other customization point into unknown code.
>
> The general issue that calling any unknown code while holding a lock
> is a recipe for deadlock. You really are required to know the
> implementation details of all code that you might call while you are
> holding a lock.

No, you are not. What you are required to do, though, is document which 
external calls are made while an internal lock is held. This is simply a 
part of the usual Concept/Requirements table for the customization point.

Good point about getHashCode, though; there is no reason to call it under a 
lock, though I see I've done the same mistake in my hash map. Thanks. :-) 




More information about the cpp-threads mailing list