]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add notes on heap allocations
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 10 Dec 2019 08:16:26 +0000 (15:16 +0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 10 Dec 2019 08:16:26 +0000 (15:16 +0700)
src/lib/util/thread_local.h

index 5fa309b6b84739bb2a6d9b26aec527ebfc1fd406..0412e683ec6f63c2d914885bab0aeb6996c75487 100644 (file)
@@ -49,8 +49,11 @@ typedef void (*pthread_destructor_t)(void*);
  *     These should ONLY be called where __Thread_local is a pointer to heap
  *     allocated memory that needs to be freed on thread exit.
  *
- *     For other types like ints _Thread_local should be used directly
- *     without the macros.
+ *     Depending on the platform, the thread local storage itself may be freed
+ *     before the destructor is called.
+ *
+ *     The only way this code can work is if the value passed to the destructor
+ *     initialisation is the address of non-TLS memory.
  */
 /** Pre-initialise resources required for a thread local destructor
  *