mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Make delegateDelay property atomic and access it via self.
PiperOrigin-RevId: 832080864
This commit is contained in:
committed by
Copybara-Service
parent
2d272f59ea
commit
8375b82a86
@@ -56,7 +56,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property(nonatomic, nullable, readwrite) NSError *readValueForCharacteristicError;
|
||||
|
||||
/** Similates a delay in all delegate calls by the specified amount. */
|
||||
@property(nonatomic, readwrite) NSTimeInterval delegateDelay;
|
||||
@property(readwrite) NSTimeInterval delegateDelay;
|
||||
|
||||
/**
|
||||
* Similates a @c openL2CAPChannelWithPSM: error.
|
||||
|
||||
@@ -136,10 +136,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
}
|
||||
|
||||
- (void)delayDelegateUsingBlock:(void (^)())block {
|
||||
if (_delegateDelay <= 0) {
|
||||
NSTimeInterval delegateDelay = self.delegateDelay;
|
||||
if (delegateDelay <= 0) {
|
||||
block();
|
||||
} else {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, _delegateDelay * NSEC_PER_SEC),
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delegateDelay * NSEC_PER_SEC),
|
||||
dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
|
||||
block();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user