Hello.
Is it feasible to make CVs' destructors thread-safe? Consider the code
below. It causes a failed assertion in
basic_condition_variable::dispose_entry(...) when cv's destructor kicks in
while notify_all() is still cleaning up.
The problem is easily resolved by adding another mutex, but it would just
look nicer if we could rely on cv's own features for that.
Another alternative would be to make wait() return only after notify_xxx()
has really finished its job.
(Yes, I guess this code is not exactly a Good Practice :) , but it's not
exactly logically inconsistent either. Or is it?)
[
Boost 1.35.0, MSVC2008, Win32 Debug configuration
Actually, it's not easy to make this particular code fail; adding a short
sleep() in the beginning of dispose_entry(...) helps. This problem managed
to appear quite systematically in a more complex program though.
]
----
Vladimir
:::CODE:::
#include