Fix crash in releasing TLS from CUDA EP dtor (#2329)
thread_local/global/static destruction order depends on implementation details of compilers and OS. The bug happens when thread_local is already out of scope while static EP being destructed, thus causing access violation in EP's destructor when accessing thread_local. The fix is to maintain ownership inside EP with a mapping from tid to ThreadLocalContext, to avoid accessing thread_local in EP's destructor. This way, no matter what the destruction order is, no access violation would be triggered.
K
KeDengMS committed
58e6aaa414d05293f68e8480f4bc0c4980e4fa63
Parent: c0b8926
Committed by GitHub <noreply@github.com>
on 11/6/2019, 9:00:17 PM