A core-cached shared_ptr
authorGiuseppe Ottaviano <ott@fb.com>
Wed, 24 May 2017 05:52:12 +0000 (22:52 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 24 May 2017 06:04:53 +0000 (23:04 -0700)
commitb1eb5b684447a4a58516d5e8ffbd328aab1e477d
tree022e913d501e8bf1784f0b5c9c9bc23f9bc7c498
parent8bca2fb294ee888e2c9b73123205868c0c947a51
A core-cached shared_ptr

Summary:
This class serves a similar use case to `ReadMostlySharedPtr`, but with two differences:

- It returns actual `shared_ptr`s, so it can be used as a drop-in replacement.
- Its memory utilization is constant, independent of the number of threads that use it.

Also, the code is much simpler. On the other hand, it is about 4x slower (but it still scales linearly in the number of concurrent threads acquiring the reference).

Reviewed By: djwatson

Differential Revision: D5104730

fbshipit-source-id: 8c18b635e0390394b06417b6df8b790e4bd2d90d
folly/Enumerate.h
folly/Makefile.am
folly/concurrency/CoreCachedSharedPtr.h [new file with mode: 0644]
folly/concurrency/test/CoreCachedSharedPtrTest.cpp [new file with mode: 0644]
folly/experimental/test/ReadMostlySharedPtrBenchmark.cpp