Fix races in TLRefCount
Summary: This fixes 2 races in TLRefCount: 1. Thread-local constructor race, exposed by the stress test. It was possible for LocalRefCount to be created (grabbing collectGuard), but not be added to the thread-local list, so that accessAllThreads wasn't collecting it. collectAll() was then blocking waiting on baton to be posted, causing a dead-lock. 2. LocalRefCount::count_ has to be made atomic, because otherwise += operation may be not flushed (nbronson explained the race in D3133443). Reviewed By: djwatson Differential Revision: D3166956 fb-gh-sync-id: 17d58a215ebfc572f8316ed46bafaa5e6a9e2368 fbshipit-source-id: 17d58a215ebfc572f8316ed46bafaa5e6a9e2368
Showing
Please register or sign in to comment