Skip to content

Commit 53d308a

Browse files
committed
Add an explicit barrier, mostly for clarity
1 parent 1d3ee23 commit 53d308a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

stdlib/public/stubs/FoundationHelpers.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ SWIFT_RUNTIME_EXPORT void swift_initializeCoreFoundationState(CFBridgingState co
123123
//It's fine if this runs more than once, it's a noop if it's been done before
124124
//and we want to make sure it still happens if CF loads late after it failed initially
125125
bridgingState = state;
126+
std::atomic_thread_fence(std::memory_order_seq_cst); //This is probably unnecessary, but thinking through why it's unnecessary has given multiple people headaches now, and since this only runs once it's not a big deal to just have the barrier.
126127
_reparentClasses();
127128
}
128129

0 commit comments

Comments
 (0)