Skip to content

Commit

Permalink
feat: add flag to disable main-runloop sync. (#73)
Browse files Browse the repository at this point in the history
Use experimental flag `DTXDisableMainRunLoopSync` for testing purposes.
  • Loading branch information
asafkorem authored Mar 14, 2024
1 parent de451fe commit f69efdb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions DetoxSync/DetoxSync/SyncManager/DTXSyncManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,16 @@ + (void)__superload
_pendingIdleBlocks = [NSMutableArray new];

_trackedThreads = [NSMapTable weakToStrongObjectsMapTable];

[_trackedThreads setObject:@{@"name": @"Main Thread"} forKey:[NSThread mainThread]];

[self _trackCFRunLoop:CFRunLoopGetMain() name:@"Main RunLoop"];

// Experimental: disable main run-loop sync, due to excessive activity on the main thread.
BOOL shouldDisableMainRunLoopSync =
[NSUserDefaults.standardUserDefaults boolForKey:@"DTXDisableMainRunLoopSync"];
if (!shouldDisableMainRunLoopSync) {
[self _trackCFRunLoop:CFRunLoopGetMain() name:@"Main RunLoop"];
}

_systemWasBusy = DTXIsSystemBusyNow();
}
}
Expand Down

0 comments on commit f69efdb

Please sign in to comment.