Skip to content

Commit edc74b2

Browse files
committed
[Concurrency] Always assume that if expecting main actor and are on main thread that this is equal
1 parent 9c76e8e commit edc74b2

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,9 @@ static bool swift_task_isCurrentExecutorImpl(SerialExecutorRef expectedExecutor)
388388
// the expected executor however, so we need to try a bit harder before
389389
// we fail.
390390

391-
// Legacy special handling the main executor by detecting the main thread.
392-
//
393-
// When 'checkIsolated' is available it will perform a dispatch queue assertion
394-
// against the main queue, potentially resulting in a crash (expected).
395-
//
396-
// In legacy mode, we cannot allow crashes here, and therefore we keep the
397-
// special best-effort handling of the "main thread".
398-
if (isCurrentExecutorMode == Legacy_NoCheckIsolated_NonCrashing) {
399-
if (expectedExecutor.isMainExecutor() && isExecutingOnMainThread()) {
400-
return true;
401-
}
391+
// Special handling the main executor by detecting the main thread.
392+
if (expectedExecutor.isMainExecutor() && isExecutingOnMainThread()) {
393+
return true;
402394
}
403395

404396
// We cannot use 'complexEquality' as it requires two executor instances,

0 commit comments

Comments
 (0)