• Doron Roberts-Kedes's avatar
    folly DeterministicSchedule: joinAll() as a workaround to thread local destructor issues · 2df6e3b0
    Doron Roberts-Kedes authored
    Summary:
    There was a problem with DeterministicSchedule when threads issued shared access stores/loads to atomics during thread local destructors. Thread local destructors run after a thread terminates, and therefore after all of the DSched cleanup work in beforeThreadExit() is already complete.
    
    The new DSched::joinAll() functions works around this problem by blocking the parent until all child threads are blocked at the end of beforeThreadExit(). The parent then lets each child thread proceed one at a time through the thread local destructor with a paired sem_post and .join().
    
    Reviewed By: djwatson
    
    Differential Revision: D13381250
    
    fbshipit-source-id: 80ab39b3f2f71ee69dfbaec9950dfc5908874353
    2df6e3b0
BufferedAtomic.h 12.3 KB