|
30 | 30 | #include "swift/Runtime/Bincompat.h"
|
31 | 31 | #include "swift/Runtime/Casting.h"
|
32 | 32 | #include "swift/Runtime/DispatchShims.h"
|
| 33 | +#include "swift/Runtime/EnvironmentVariables.h" |
33 | 34 | #include "swift/Threading/Mutex.h"
|
34 | 35 | #include "swift/Threading/Once.h"
|
35 | 36 | #include "swift/Threading/Thread.h"
|
@@ -351,15 +352,16 @@ static void checkIsCurrentExecutorMode(void *context) {
|
351 | 352 |
|
352 | 353 | // Potentially, override the platform detected mode, primarily used in tests.
|
353 | 354 | #if SWIFT_STDLIB_HAS_ENVIRON
|
354 |
| - const char *modeStr = getenv("SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE"); |
355 |
| - if (!modeStr) |
356 |
| - return; |
357 |
| - |
358 |
| - if (strcmp(modeStr, "nocrash") == 0) { |
359 |
| - useLegacyMode = Legacy_NoCheckIsolated_NonCrashing; |
360 |
| - } else if (strcmp(modeStr, "crash") == 0) { |
361 |
| - useLegacyMode = Default_UseCheckIsolated_AllowCrash; |
362 |
| - } // else, just use the platform detected mode |
| 355 | + if (const char *modeStr = |
| 356 | + runtime::environment::concurrencyIsCurrentExecutorLegacyModeOverride()) { |
| 357 | + if (modeStr) { |
| 358 | + if (strcmp(modeStr, "nocrash") == 0) { |
| 359 | + useLegacyMode = true; |
| 360 | + } else if (strcmp(modeStr, "crash") == 0) { |
| 361 | + useLegacyMode = false; |
| 362 | + } // else, just use the platform detected mode |
| 363 | + } |
| 364 | + } |
363 | 365 | #endif // SWIFT_STDLIB_HAS_ENVIRON
|
364 | 366 | isCurrentExecutorMode = useLegacyMode ? Legacy_NoCheckIsolated_NonCrashing
|
365 | 367 | : Default_UseCheckIsolated_AllowCrash;
|
|
0 commit comments