Skip to content

Commit f49e6ad

Browse files
committed
Fix a data race in the conformsToProtocol method.
This bug was reported by TSan.
1 parent 92fae2e commit f49e6ad

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

stdlib/public/runtime/ProtocolConformance.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,9 @@ swift::swift_conformsToProtocol(const Metadata *type,
560560
return FoundConformance.first;
561561
}
562562

563-
unsigned failedGeneration = ConformanceCacheGeneration;
564-
565563
// If we didn't have an up-to-date cache entry, scan the conformance records.
566564
C.SectionsToScanLock.lock();
565+
unsigned failedGeneration = ConformanceCacheGeneration;
567566

568567
// If we have no new information to pull in (and nobody else pulled in
569568
// new information while we waited on the lock), we're done.

0 commit comments

Comments
 (0)