CDRIVER-4220 simplify and test obsolete bson_sync_synchronize API #1766
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
bson_sync_synchronize()
API, a basic platform-specific wrapper around an unspecific memory fence, was added back in 2013 and used briefly formongoc-counters
. That use has since been replaced bybson_atomic_thread_fence()
.We don't know of any other users of this API but it was technically exposed as public, so third party code may still rely on it appearing in
bson-compat.h
.We plan to remove atomics from the API in 2.0, see:
#1762
To align
bson_sync_synchronize()
with our plans, this patch replaces the original macro definition with an inline function that's equivalent tobson_atomic_thread_fence()
, and this function is marked as deprecated. We will remove the function entirely for 2.0, along withbson-atomic.h
.Manually tested that the expected deprecation appears when using
bson_sync_synchronize()
from external code. Included a trivial automated test which can't verify the deprecation warning or the memory fence functionality, but it will catch compile failures or crashes.