Skip to content

Commit 7283fb7

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

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,19 @@ 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
363+
if (modeStr) {
364+
if (strcmp(modeStr, "nocrash") == 0) {
365+
useLegacyMode = true;
366+
} else if (strcmp(modeStr, "crash") == 0) {
367+
useLegacyMode = false;
361368
} // else, just use the platform detected mode
362369
} // no override, use the default mode
363370
#endif // SWIFT_STDLIB_HAS_ENVIRON

0 commit comments

Comments
 (0)