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

[ASTraitCollection] Convert ASPrimitiveTraitCollection from lock to atomic. #355

Merged
merged 2 commits into from
Jun 14, 2017

Conversation

appleguy
Copy link
Member

@appleguy appleguy commented Jun 12, 2017

This resolves a deadlock case, which might be more common with Yoga (unsure): #353 . Fortunately it also simplifies the code.

We should think carefully if there are any transactional locking cases that could cause this to be unsafe. However, I think it has fairly limited usage and is probably appropriate for an atomic.

@appleguy appleguy self-assigned this Jun 12, 2017
Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change. But with C++ atomics, you can actually use plain old assignment semantics e.g.:

int val = _myAtomicInt;
_myAtomicInt = 5;

I think we should prefer this style since it's so much prettier. Agree?

@appleguy
Copy link
Member Author

@Adlai-Holler oh wow, does this mean that ASLayoutElementStyle can also do that? I didn't know this worked, presumably operator overloading to call .store() for you.

Sure, I'll change it.

Copy link
Member

@garrettmoon garrettmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems safe overall to me. One concern I have is fragmentation of property locking without a cohesive documented strategy.

@appleguy
Copy link
Member Author

@garrettmoon yeah, that's a good point and something we should talk more about strategically. I think we need to do some high level data flow analysis and make a call such as flags and a small number of other properties maybe are OK to use atomics, but even that could potentially need value-capture at the beginning of locking scopes that use the flag multiple times (this is rare but can happen)

@appleguy appleguy merged commit 81def94 into master Jun 14, 2017
@appleguy appleguy deleted the RadioactiveEnvironment branch June 14, 2017 20:55
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…tomic. (TextureGroup#355)

* [ASTraitCollection] Convert ASPrimitiveTraitCollection from lock to atomic.

This resolves a deadlock case: TextureGroup#353

* [ASTraitCollection] Use assignment operator instead of .store() for C++ atomic.
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.

None yet

3 participants