Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Crashlytics/Crashlytics/Components/FIRCLSContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ void FIRCLSContextBaseInit(void) {
NSString* exceptionQueueName = [sdkBundleID stringByAppendingString:@".exception"];

_firclsLoggingQueue = dispatch_queue_create([loggingQueueName UTF8String], DISPATCH_QUEUE_SERIAL);
dispatch_queue_set_specific(_firclsLoggingQueue, &_firclsLoggingQueue, &_firclsLoggingQueue,
NULL);
Comment thread
JesusRojass marked this conversation as resolved.
Outdated
_firclsBinaryImageQueue =
dispatch_queue_create([binaryImagesQueueName UTF8String], DISPATCH_QUEUE_SERIAL);
_firclsExceptionQueue =
Expand Down Expand Up @@ -437,3 +439,15 @@ bool FIRCLSContextRecordMetadata(NSString* rootPath, const FIRCLSContextInitData

return true;
}

void FIRCLSExecuteOnLoggingQueue(void (^block)(void)) {
if (!block) {
return;
}

if (dispatch_get_specific(&_firclsLoggingQueue) != NULL) {
block();
} else if (_firclsLoggingQueue) {
dispatch_sync(_firclsLoggingQueue, block);
}
Comment thread
JesusRojass marked this conversation as resolved.
Outdated
}
Comment thread
JesusRojass marked this conversation as resolved.
2 changes: 2 additions & 0 deletions Crashlytics/Crashlytics/Components/FIRCLSGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ extern dispatch_queue_t _firclsExceptionQueue;
#define FIRCLSGetBinaryImageQueue() (_firclsBinaryImageQueue)
#define FIRCLSGetExceptionQueue() (_firclsExceptionQueue)

void FIRCLSExecuteOnLoggingQueue(void (^block)(void));

__END_DECLS
4 changes: 2 additions & 2 deletions Crashlytics/Crashlytics/Components/FIRCLSUserLogging.m
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void FIRCLSUserLoggingRecordKeysAndValues(NSDictionary *keysAndValues,
}
}

dispatch_sync(FIRCLSGetLoggingQueue(), ^{
FIRCLSExecuteOnLoggingQueue(^{
FIRCLSUserLoggingWriteKeysAndValues(sanitizedKeysAndValues, storage, counter,
containsNullValue);
});
Expand Down Expand Up @@ -541,7 +541,7 @@ void FIRCLSUserLoggingWriteAndCheckABFiles(FIRCLSUserLoggingABStorage *storage,
}
}

dispatch_sync(FIRCLSGetLoggingQueue(), ^{
FIRCLSExecuteOnLoggingQueue(^{
FIRCLSFile file;

if (!FIRCLSFileInitWithPath(&file, *activePath, true)) {
Expand Down
Loading