RLMThreadSafeReference
@interface RLMThreadSafeReference < __covariant Confined
: id <RLMThreadConfined>
> : NSObject @end
An object intended to be passed between threads containing a thread-safe reference to its thread-confined object.
To resolve a thread-safe reference on a target Realm on a different thread, pass to
-[RLMRealm resolveThreadSafeReference:]
.
Warning
A RLMThreadSafeReference
object must be resolved at most once.
Failing to resolve a RLMThreadSafeReference
will result in the source version of the
Realm being pinned until the reference is deallocated.
Note
Prefer short-lived RLMThreadSafeReference
s as the data for the version of the source Realm
will be retained until all references have been resolved or deallocated.
See
-[RLMRealm resolveThreadSafeReference:]
-
Create a thread-safe reference to the thread-confined object.
Note
You may continue to use and access the thread-confined object after passing it to this constructor.
Declaration
Objective-C
+ (nonnull instancetype)referenceWithThreadConfined: (nonnull Confined)threadConfined;
Swift
convenience init(threadConfined: Confined)
Parameters
threadConfined
The thread-confined object to create a thread-safe reference to.
-
Indicates if the reference can no longer be resolved because an attempt to resolve it has already occurred. References can only be resolved once.
Declaration
Objective-C
@property (readonly, getter=isInvalidated, nonatomic) BOOL invalidated;
Swift
var isInvalidated: Bool { get }
-
-[RLMThreadSafeReference init]
is not available becauseRLMThreadSafeReference
cannot be created directly.RLMThreadSafeReference
instances must be obtained by calling-[RLMRealm resolveThreadSafeReference:]
.Declaration
Objective-C
- (nonnull instancetype)init;
-
-[RLMThreadSafeReference new]
is not available becauseRLMThreadSafeReference
cannot be created directly.RLMThreadSafeReference
instances must be obtained by calling-[RLMRealm resolveThreadSafeReference:]
.Declaration
Objective-C
+ (nonnull instancetype) new;