37
37
return ; \
38
38
}
39
39
40
- #define RUN_BLOCK_IF_MAIN (block ) \
41
- RUN_BLOCK_IF ([NSThread isMainThread ], block)
42
-
43
40
/* Returns the MainThread latency threshold in milliseconds
44
41
* used to detect slow operations that may cause high latencies or delays.
45
42
* If negative, the MainThread monitor is disabled */
@@ -340,7 +337,7 @@ + (NSString*)getCallerStack:(NSString*)prefixSymbol {
340
337
+ (void )performOnMainThreadNowOrLater : (BOOL )useJavaModes
341
338
block : (void (^)())block
342
339
{
343
- RUN_BLOCK_IF_MAIN ( block);
340
+ RUN_BLOCK_IF ([ NSThread isMainThread ], block);
344
341
345
342
[ThreadUtilities performOnMainThread: @selector (invokeBlockCopy: ) on: self withObject: Block_copy (block)
346
343
waitUntilDone: NO useJavaModes: useJavaModes];
@@ -362,7 +359,7 @@ + (void)performOnMainThreadWaiting:(BOOL)wait
362
359
useJavaModes : (BOOL )useJavaModes
363
360
block : (void (^)())block
364
361
{
365
- RUN_BLOCK_IF_MAIN ( block);
362
+ RUN_BLOCK_IF ([ NSThread isMainThread ] && wait , block);
366
363
367
364
[ThreadUtilities performOnMainThread: @selector (invokeBlockCopy: ) on: self withObject: Block_copy (block)
368
365
waitUntilDone: wait useJavaModes: useJavaModes];
@@ -443,7 +440,7 @@ + (void)performOnMainThreadWithTracing:(SEL)aSelector
443
440
waitUntilDone : (BOOL )wait
444
441
useJavaModes : (BOOL )useJavaModes
445
442
{
446
- const BOOL invokeDirect = NSThread . isMainThread && wait ;
443
+ const BOOL invokeDirect = [ NSThread isMainThread ] && wait ;
447
444
const BOOL doWait = !invokeDirect && wait ;
448
445
const BOOL blockingEDT = doWait && isEventDispatchThread ();
449
446
0 commit comments