Skip to content

[6.0][Concurrency] Fix too eager early return in checkIsolation mode detecting #73496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions stdlib/public/Concurrency/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,16 @@ static void checkIsCurrentExecutorMode(void *context) {

// Potentially, override the platform detected mode, primarily used in tests.
#if SWIFT_STDLIB_HAS_ENVIRON
const char *modeStr = getenv("SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE");
if (!modeStr)
return;

if (strcmp(modeStr, "nocrash") == 0) {
useLegacyMode = Legacy_NoCheckIsolated_NonCrashing;
} else if (strcmp(modeStr, "crash") == 0) {
useLegacyMode = Default_UseCheckIsolated_AllowCrash;
} // else, just use the platform detected mode
if (const char *modeStr =
getenv("SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE")) {
if (modeStr && *modeStr) {
if (strcmp(modeStr, "nocrash") == 0) {
useLegacyMode = true;
} else if (strcmp(modeStr, "crash") == 0) {
useLegacyMode = false;
} // else, just use the platform detected mode
}
}
#endif // SWIFT_STDLIB_HAS_ENVIRON
isCurrentExecutorMode = useLegacyMode ? Legacy_NoCheckIsolated_NonCrashing
: Default_UseCheckIsolated_AllowCrash;
Expand Down