Attempts to acquire a recursive spinlock to ensure the validity of values you retrieve during the transaction.
- iOS 8.0+
- macOS 10.8+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
SceneKit’s data model is thread-safe in that it ensures that internal data structures will not be corrupted by concurrent attempts to modify their contents from multiple threads. However, this model does not guarantee the validity of values you read from scene graph objects after returning them.
For example, consider the following operation:
The intent of this line is to move a node by ten units. But if another thread modifies the node’s
position property concurrently, the new position value could be unexpected. If your app modifies the scene graph from multiple threads, use a transaction lock to ensure that your modifications take effect as intended.
If another thread currently holds a lock on the transaction, calling
lock() has no effect.