Skip to content

Commit

Permalink
Fix race condition in new suspension handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tmolitor-stud-tu committed Dec 1, 2024
1 parent 7d43f9c commit 336afdf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Monal/Classes/HelperTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -2094,11 +2094,14 @@ +(void) flushLogsWithTimeout:(double) timeout

+(void) signalSuspension
{
DDLogVerbose(@"Suspending logger queue...");
[HelperTools flushLogsWithTimeout:0.100];
@synchronized(_suspensionHandlingLock) {
dispatch_suspend([DDLog loggingQueue]);
_suspensionHandlingIsSuspended = YES;
if(!_suspensionHandlingIsSuspended)
{
DDLogVerbose(@"Suspending logger queue...");
[HelperTools flushLogsWithTimeout:0.100];
dispatch_suspend([DDLog loggingQueue]);
_suspensionHandlingIsSuspended = YES;
}
}
DDLogVerbose(@"Posting kMonalIsFreezed notification now...");
[[NSNotificationCenter defaultCenter] postNotificationName:kMonalIsFreezed object:nil];
Expand Down

0 comments on commit 336afdf

Please sign in to comment.