Skip to content

Conversation

@neakor
Copy link
Contributor

@neakor neakor commented Dec 13, 2018

As of iOS 10.0 and MacOS 10.12 the old OSMemoryBarrier, OSAtomicCompareAndSwap64Barrier, OSAtomicIncrement64Barrier, and `OSAtomicDecrement64Barrier, APIs are deprecated. The warnings suggested new APIs are C++ and are not accessible from Swift.

OSMemoryBarrier can be directly replaced with atomic_thread_fence(memory_order_seq_cst) which is accessible from Swift.

The rest of the suggested C++ APIs atomic_fetch_add, atomic_fetch_sub, and atomic_compare_exchange_strong are not accessible from Swift. This change creates a Objective-C wrapper for these C++ APIs, so Swift code can access them.

As of iOS 10.0 and MacOS 10.12 the old `OSMemoryBarrier`, `OSAtomicCompareAndSwap64Barrier`, `OSAtomicIncrement64Barrier`, and `OSAtomicDecrement64Barrier, APIs are deprecated. The warnings suggested new APIs are C++ and are not accessible from Swift.

`OSMemoryBarrier` can be directly replaced with `atomic_thread_fence(memory_order_seq_cst)` which is accessible from Swift.

The rest of the suggested C++ APIs `atomic_fetch_add`, `atomic_fetch_sub`, and `atomic_compare_exchange_strong` are not accessible from Swift. This change creates a Objective-C wrapper for these C++ APIs, so Swift code can access them.
@rudro rudro merged commit 9c2d8fb into master Dec 13, 2018
@rudro rudro deleted the deprecated_atomic_int_apis branch December 13, 2018 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants