-
Notifications
You must be signed in to change notification settings - Fork 430
@W-19078443 Main Thread runtime warnings in MSDK #3905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (63.63%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #3905 +/- ##
==========================================
+ Coverage 63.09% 63.17% +0.07%
==========================================
Files 250 250
Lines 22488 22517 +29
==========================================
+ Hits 14189 14225 +36
+ Misses 8299 8292 -7
🚀 New features to boost your workflow:
|
NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:self.storeDirectory error:nil]; | ||
if (files) { | ||
self.numStoredEvents = files.count; | ||
@synchronized (self.eventCountMutex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You just created the object you synchronize on at line 71, so how will it keep other threads out?
Should you do @synchronized ([self class]) instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or use a static member:
static NSObject *initMutex;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
initMutex = [[NSObject alloc] init];
});
@synchronized (initMutex) {
// initialization code
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah. Good point. Let me look at what the SApp did again.
Addresses potential data races and thread safety issues in the Salesforce Mobile SDK Core and Analytics modules. The changes ensure that shared mutable state is accessed in a thread-safe manner and that account management operations are properly synchronized.
SApp Change: https://git.soma.salesforce.com/iOS/SalesforceMobileSDK-iOS/pull/921