Skip to content

Commit aa3e16d

Browse files
authored
Merge pull request swiftlang#20462 from aschwaighofer/dyn_repl_entry_point_must_hold_lock
2 parents 2a4e1b8 + 4cb1c33 commit aa3e16d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,12 +1645,14 @@ void swift::addImageDynamicReplacementBlockCallback(
16451645
[&] { automaticReplacements->enableReplacements(); });
16461646
}
16471647

1648-
void swift::swift_enableDynamicReplacementScope(const DynamicReplacementScope *scope) {
1649-
scope->enable();
1648+
void swift::swift_enableDynamicReplacementScope(
1649+
const DynamicReplacementScope *scope) {
1650+
DynamicReplacementLock.get().withLock([=] { scope->enable(); });
16501651
}
16511652

1652-
void swift::swift_disableDynamicReplacementScope(const DynamicReplacementScope *scope) {
1653-
scope->disable();
1653+
void swift::swift_disableDynamicReplacementScope(
1654+
const DynamicReplacementScope *scope) {
1655+
DynamicReplacementLock.get().withLock([=] { scope->disable(); });
16541656
}
16551657
#define OVERRIDE_METADATALOOKUP COMPATIBILITY_OVERRIDE
16561658
#include "CompatibilityOverride.def"

0 commit comments

Comments
 (0)