Make RequestContext rootid value atomic in RequestContext::StaticContext.
Summary: Currently RequestContext::getRootidsFromAllThreads() can access StaticContext root ids concurrently with RequestContext::setRequestContext() without synchronization guards, which is not safe cross other platforms than x64 and also causing TSAN warnings when used in server contexts. Therefore we can make it std::atomic and access it with relaxed order. This won't affect performance in major platform like x64 since the loads/stores instructions will be the same. Also as a side effect this prevents RequestContext::StaticContext from generating copy/move constructor, so we remove an extra copy of root id in StaticContext in setRequestContext path. Reviewed By: yfeldblum Differential Revision: D22083558 fbshipit-source-id: ed70e394f1172b07ba00c15f05a370f84265785c
Showing
Please register or sign in to comment