2) The test case. Right now, it just tries to provoke potential race
conditions by running the code in questions as possible in each
thread.
This is obviously a stochastic approach an may give false positives.
I'm
not aware of any other useful tests to perform to check for thread
safety, other than maybe formal verification, which doesn't seem to be
anywhere near mature enough. Tips from the gurus would be appreciated,
as I need similar, but more complex test cases for the lock-free
containers.
- Specific to the shared_ptr, I'll probably put back the lock for the
shared_ptr<T, false> specialisation when __GTHREADS is defined, in
case
any existing code relies on it being there. (despite the standard or
documentation not saying anything about thread safety)