Skip to content

Commit

Permalink
santad: Synchronize access to metric callback array (#1405)
Browse files Browse the repository at this point in the history
  • Loading branch information
russellhancox committed Jul 29, 2024
1 parent 9a7dcef commit 1ce4756
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Source/common/SNTMetricSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,15 @@ - (void)addConstantBooleanWithName:(NSString *)name

/** Export current state of the SNTMetricSet as an NSDictionary. */
- (NSDictionary *)export {
NSDictionary *exported = nil;
NSDictionary *exported;

NSArray *callbacks;
@synchronized(self) {
callbacks = [_callbacks mutableCopy];
}

// Invoke callbacks to ensure metrics are up to date.
for (void (^cb)(void) in _callbacks) {
for (void (^cb)(void) in callbacks) {
cb();
}

Expand Down

0 comments on commit 1ce4756

Please sign in to comment.