Thread-safe RequestContext putIfAbsent operation
authorMichael Bejda <mibpl@fb.com>
Mon, 25 Jan 2016 17:45:49 +0000 (09:45 -0800)
committerfacebook-github-bot-1 <folly-bot@fb.com>
Mon, 25 Jan 2016 18:20:24 +0000 (10:20 -0800)
commit1721cad02dfff0e9af2e3d79e370a84d5c1f7295
treecfc06bfb6519baced1053eb9a71b1deb9084d6f5
parent1723592cef9164c8e72d57417f5a33162b867f63
Thread-safe RequestContext putIfAbsent operation

Summary:
Adds a thread-safe putIfAbsent operation to the RequestContext. The current setContextData() is not sufficent to do it safely.
Just like setContextData, this method is unfair, as a high volume of reads will block the spinlock.

Reviewed By: fugalh

Differential Revision: D2850752

fb-gh-sync-id: 2ff22ea9e9bd8f27f6ae7a57214a6dbc4fdcd4c5
folly/io/async/Request.h
folly/io/async/test/RequestContextTest.cpp