-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(utils): Remove global buffer used when writing files to disk
write(2) already intelligently handles buffering/writing, so this buffer is unneeded in addition to being unsafe for the user-initiated reporting case. The buffer was added in kstenerud/KSCrash@be9bedb and thus the original intent is lost to the mists.
- Loading branch information
Showing
9 changed files
with
111 additions
and
34 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
5 changes: 5 additions & 0 deletions
5
...xtures/ios-swift-cocoapods/iOSTestApp/scenarios/ManyConcurrentNotifyNoBackgroundThreads.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,5 @@ | ||
#import "Scenario.h" | ||
|
||
@interface ManyConcurrentNotifyNoBackgroundThreads : Scenario | ||
|
||
@end |
46 changes: 46 additions & 0 deletions
46
...xtures/ios-swift-cocoapods/iOSTestApp/scenarios/ManyConcurrentNotifyNoBackgroundThreads.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,46 @@ | ||
#import "ManyConcurrentNotifyNoBackgroundThreads.h" | ||
|
||
@interface ManyConcurrentNotifyNoBackgroundThreads () | ||
@property (nonatomic) dispatch_queue_t queue1; | ||
@property (nonatomic) dispatch_queue_t queue2; | ||
@end | ||
|
||
@interface BarError : NSError | ||
@end | ||
@implementation BarError | ||
@end | ||
|
||
@implementation ManyConcurrentNotifyNoBackgroundThreads | ||
|
||
- (instancetype)initWithConfig:(BugsnagConfiguration *)config { | ||
if (self = [super initWithConfig:config]) { | ||
_queue1 = dispatch_queue_create("Log Queue 1", DISPATCH_QUEUE_CONCURRENT); | ||
_queue2 = dispatch_queue_create("Log Queue 2", DISPATCH_QUEUE_CONCURRENT); | ||
} | ||
return self; | ||
} | ||
|
||
- (void)run { | ||
for (int i = 0; i < 4; i++) { | ||
NSString *message = [NSString stringWithFormat:@"Err %ld", (long)i]; | ||
[self logError:[BarError errorWithDomain:@"com.example" | ||
code:401 + i | ||
userInfo:@{NSLocalizedDescriptionKey: message}]]; | ||
} | ||
} | ||
|
||
- (void)logError:(NSError *)error { | ||
dispatch_async(self.queue1, ^{ | ||
[Bugsnag notifyError:error]; | ||
}); | ||
dispatch_async(self.queue2, ^{ | ||
[Bugsnag notifyError:error]; | ||
}); | ||
} | ||
|
||
- (void)startBugsnag { | ||
self.config.autoTrackSessions = NO; | ||
[super startBugsnag]; | ||
[Bugsnag setSuspendThreadsForUserReported:NO]; | ||
} | ||
@end |
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