-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Avoid crash/deadlock when calling notify() concurrently (#401)
- Loading branch information
Showing
24 changed files
with
295 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashIdentifier.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef HDR_BSG_KSCrashIdentifier_h | ||
#define HDR_BSG_KSCrashIdentifier_h | ||
#include <stdbool.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* Generates a new UUID. Not async signal safe. Caller responsible for | ||
* freeing allocated string. | ||
*/ | ||
const char *bsg_kscrash_generate_report_identifier(void); | ||
/** | ||
* Generates a new path string. Not async signal safe. Caller responsible | ||
* for freeing allocated string. | ||
*/ | ||
const char *bsg_kscrash_generate_report_path(const char *identifier, | ||
bool is_recrash_report); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // HDR_BSG_KSCrashIdentifier_h |
23 changes: 23 additions & 0 deletions
23
Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashIdentifier.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#import "BSG_KSCrashIdentifier.h" | ||
#import "BSG_KSCrashAdvanced.h" | ||
#import <Foundation/Foundation.h> | ||
#import <string.h> | ||
|
||
const char *bsg_kscrash_generate_report_identifier(void) { | ||
return strdup([[[NSUUID UUID] UUIDString] UTF8String]); | ||
} | ||
|
||
const char *bsg_kscrash_generate_report_path(const char *identifier, | ||
bool is_recrash_report) { | ||
if (identifier == NULL) { | ||
return NULL; | ||
} | ||
BSG_KSCrashReportStore *store = [[BSG_KSCrash sharedInstance] crashReportStore]; | ||
NSString *reportID = [NSString stringWithUTF8String:identifier]; | ||
|
||
if (is_recrash_report) { | ||
return strdup([[store pathToRecrashReportWithID:reportID] UTF8String]); | ||
} else { | ||
return strdup([[store pathToFileWithId:reportID] UTF8String]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.