Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 20 additions & 0 deletions Crashlytics/Crashlytics/Components/FIRCLSContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ void FIRCLSContextBaseInit(void) {
NSString* exceptionQueueName = [sdkBundleID stringByAppendingString:@".exception"];

_firclsLoggingQueue = dispatch_queue_create([loggingQueueName UTF8String], DISPATCH_QUEUE_SERIAL);
if (_firclsLoggingQueue) {
dispatch_queue_set_specific(_firclsLoggingQueue, &_firclsLoggingQueue, &_firclsLoggingQueue,
NULL);
}
_firclsBinaryImageQueue =
dispatch_queue_create([binaryImagesQueueName UTF8String], DISPATCH_QUEUE_SERIAL);
_firclsExceptionQueue =
Expand Down Expand Up @@ -437,3 +441,19 @@ bool FIRCLSContextRecordMetadata(NSString* rootPath, const FIRCLSContextInitData

return true;
}

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

if (!_firclsLoggingQueue) {
FIRCLSSDKLogWarn(
"FIRCLSExecuteOnLoggingQueue invoked with NULL logging queue; running block inline.\n");
block();
} else if (dispatch_get_specific(&_firclsLoggingQueue) != NULL) {
block();
} else {
dispatch_sync(_firclsLoggingQueue, block);
}
}
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