List of all members | Public Member Functions
casadi::ThreadLocalStorage< T > Class Template Reference

Thread-local storage wrapper that avoids destructor calls. More...

#include <casadi_common.hpp>

Detailed Description

template<typename T>
class casadi::ThreadLocalStorage< T >

Works around MinGW-w64 bug where thread_local destructors may run after static object destructors, causing crashes at DLL unload. The wrapped object is placement-new'd into aligned storage and never destructed. Memory is reclaimed when thread exits.

Definition at line 339 of file casadi_common.hpp.

Public Member Functions

T & get ()
 

Member Function Documentation

◆ get()

template<typename T >
T& casadi::ThreadLocalStorage< T >::get ( )
inline

Definition at line 343 of file casadi_common.hpp.

343  {
344  if (!init_) {
345  new (storage_) T();
346  init_ = true;
347  }
348  return *reinterpret_cast<T*>(storage_);
349  }

References casadi::T.

Referenced by casadi::uerr(), and casadi::uout().


The documentation for this class was generated from the following file: