Skip to content

Commit ff9b138

Browse files
committed
[Concurrency] Fix embedded, cannot refer to runtime/env vars from Actor.cpp
1 parent 347864b commit ff9b138

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,20 @@ bool swift_bincompat_useLegacyNonCrashingExecutorChecks() {
352352

353353
// Potentially, override the platform detected mode, primarily used in tests.
354354
#if SWIFT_STDLIB_HAS_ENVIRON
355-
if (const char *modeStr = runtime::environment::
356-
concurrencyIsCurrentExecutorLegacyModeOverride()) {
357-
if (strcmp(modeStr, "nocrash") == 0 || strcmp(modeStr, "legacy") == 0) {
358-
return true;
359-
} else if (strcmp(modeStr, "crash") == 0 || strcmp(modeStr, "swift6") == 0) {
360-
return false; // don't use the legacy mode
355+
356+
#if SWIFT_CONCURRENCY_EMBEDDED
357+
const char *modeStr =
358+
runtime::environment::concurrencyIsCurrentExecutorLegacyModeOverride();
359+
#else
360+
// embedded does not have a runtime to read env variables from; ignore overrides
361+
const char *modeStr = nullptr;
362+
#endif // SWIFT_CONCURRENCY_EMBEDDED
363+
364+
if (modeStr) {
365+
if (strcmp(modeStr, "nocrash") == 0) {
366+
useLegacyMode = true;
367+
} else if (strcmp(modeStr, "crash") == 0) {
368+
useLegacyMode = false;
361369
} // else, just use the platform detected mode
362370
} // no override, use the default mode
363371
#endif // SWIFT_STDLIB_HAS_ENVIRON

0 commit comments

Comments
 (0)