Skip to content
  • Jonathan Peyton's avatar
    Fix for pthread_setspecific (TLS and shutdown) problem · f252010f
    Jonathan Peyton authored
    Some codes that use TLS fail intermittently because one thread tries to write
    TLS values after the TLS key has been destroyed by another thread. This happens
    when one thread executes library shutdown (and destroys TLS keys), while another
    thread starts to execute the TLS key destructor routine. Before this change, the
    kmp_init_runtime flag was checked before calling pthread_* TLS functions, but
    this flag is set to FALSE later than the destruction of the TLS keys, which
    leads to failure. The fix is to check kmp_init_gtid instead, as this flag is
    unset *before* the destruction of TLS keys.
    
    Differential Revision: http://reviews.llvm.org/D19022
    
    llvm-svn: 266674
    f252010f
Loading