Allow stealing pointer bits
authorDave Watson <davejwatson@fb.com>
Wed, 26 Jul 2017 15:07:56 +0000 (08:07 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 26 Jul 2017 15:19:46 +0000 (08:19 -0700)
commit763b84fbc36895d3b6f1da10979fb050a399133f
tree3a0fa72aaf35ebf7ed91819d4a5e7053f2df959f
parent99d6990ec46494f8cf9971d5eb53429a599baf0f
Allow stealing pointer bits

Summary:
Currently hazard pointers doesn't support stealing any of the pointer bits.
You can *almost* roll it yourself using try_protect, but this prevents
implementations from choosing their type of barrier.

This adds a new get_protected interface that you can use to steal bits, or
otherwise manipulate pointers as you would like.

This also adds a MWMR list based set example that uses it, that is wait-free
for readers (unlike the SWMR example, that is only lock-free).

Reviewed By: magedm

Differential Revision: D5455615

fbshipit-source-id: 53d282eda433e00b6b53cd804d4e1c32c74c2fb8
folly/experimental/hazptr/example/MWMRSet.h [new file with mode: 0644]
folly/experimental/hazptr/hazptr-impl.h
folly/experimental/hazptr/hazptr.h
folly/experimental/hazptr/test/HazptrTest.cpp