[PATCH] [libc++] Fix PR22606 - Leak pthread_key with static storage duration to ensure all of thread-local destructors are called.

Eric Fiselier eric at efcs.ca
Fri Jun 12 08:26:11 PDT 2015


OK. I have some new thoughts. The `__thread_struct` destructor serves three purposes when it is invoked at thread exit.

1. Notifying registered condition variables.
2. Making registered shared state ready.
3. Deleting the tuple of arguments used to start the thread.

The problem this patch is trying to solve is the case where `std::exit(0)` has been called. Once program termination has begun the only code that should be running are destructors and functions registered with `at_exit(...)`. This means that the code waiting on the CV or shared state must be doing so in a destructor. Furthermore it is likely that the registered CV's have already been destroyed.

For these reasons I don't think it is safe for libc++ to run steps #1 or #2 when program termination has begun. So I'm worried about going out of our way to support this.

I'll write up some more documentation on this and hopefully reach a conclusion.


http://reviews.llvm.org/D8802

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list