Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix thread safety issues in UsdSkel_SkelDefinition.
- In methods like _ComputeJointWorldInverseBindTransforms(), check the compute flag again after acquiring the lock to avoid potentially recomputing the result again if multiple threads were waiting on the mutex. Although the computed result would not change, it is not safe to call mutable member functions of the VtArray (which can cause a copy-on-write detach) while other threads may be in the middle of making a copy of it. - Prefer using operator|= to atomically set the flag rather than doing a read -> bitwise OR -> atomic store sequence which could cause flags to be lost if there are concurrent writes. Currently the writes are all guarded by the same mutex so the previous approach was not problematic, but the new approach is safer if e.g. in the future there are separate locks for each cached array. Bug: PixarAnimationStudios#1742
- Loading branch information