Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TSAN warning about unsynchronized access. #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DrewFitz
Copy link

Replaces deprecated usage of OSAtomicIncrement32Barrier with an NSLock.

Replaces deprecated usage of OSAtomicIncrement32Barrier with an NSLock.
@benski
Copy link
Owner

benski commented Mar 20, 2020

Hi, Drew.

I was trying to avoid using NSLock (or similar) here because it could involve blocking. ldrex/strex (OSAtomicIncrement32Barrier) is significant faster here.

One of the challenges with Swift is the lack of memory order semantics (even having atomic properties!).

Your fix definitely works and makes the static analyzer happier, and the implementation that I have cannot be "proven correct" by the analyzer, but works just fine.

Is there a way to make TSAN happy without using a blocking lock?

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