struct Rav1dWarpedMotionParams
: Make abcd: [i16; 4]
field atomic
#662
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.
This eliminates the only mutation of
Rav1dFrameHeader
, thus allowing it to be stored in anArc
without any borrowck problems.This uses the
atomig
crate to make the[i16; 4]
field atomic. The crate is quite simple, offering anAtomic<T>
type that can only be implemented for actually lock-free atomic types through a simplepack
andunpack
into an atomic type (u64
in this case for[i16; 4]
).The alternatives would to use the
atomic
crate, which also offers anAtomic<T>
, but doesn't guarantee a lock-free implementation, and whose implementation seems more complex. The other alternative would be to basically recreate whatatomig
is doing of packing and unpacking into anu64
for atomic operations, so I think using the existingatomig
crate is simpler.Update: I replaced
atomig
with an inline solution of about the same complexity.