Created attachment 155099 [details] Code snippet copied from stackoverflow and fixed to compile SUMMARY Destroying a std::condition_variable after calling notify_all() results in a helgrind warning "pthread_cond_destroy: destruction of condition variable being waited upon", even though this behaviour is apparently allowed by the C++ spec (http://en.cppreference.com/w/cpp/thread/condition_variable/~condition_variable). See this stackoverflow question (https://stackoverflow.com/questions/48093715/destruction-of-condition-variable-randomly-loses-notification) for a full discussion, although only the posts by the OP and the user mevets are worth reading. Ultimately it seems the program is correct, although the discussion is contentious which is why I've included "potential" in the bug report title. STEPS TO REPRODUCE Run the snippet in the stackoverflow question (also attached) under helgrind. OBSERVED RESULT The error message ==71731== Thread #1: pthread_cond_destroy: destruction of condition variable being waited upon ==71731== at 0x484AA83: ??? (in /usr/libexec/valgrind/vgpreload_helgrind-amd64-linux.so) ==71731== by 0x4959E3D: __gthread_cond_destroy (gthr-default.h:885) ==71731== by 0x4959E3D: ~__condvar (std_mutex.h:141) ==71731== by 0x4959E3D: std::condition_variable::~condition_variable() (condition_variable.cc:36) ==71731== by 0x1098DB: notify_on_delete::~notify_on_delete() (in a.out) ==71731== by 0x109381: main (in a.out) EXPECTED RESULT No error messages. SOFTWARE/OS VERSIONS valgrind-3.20.0.GIT Target: x86_64-pc-linux-gnu gcc version 12.2.0 (GCC)
"only the posts by the OP and the user mevets are worth reading" SO in a nutshell.
This also seems to apply to DRD.