Skip to content

Commit 05af82e

Browse files
committed
PR feedback
1 parent c8ec1ac commit 05af82e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/Swift/Core/Helper/SentryExtraPackages.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import Foundation
1212

1313
let newPackage = ["name": name, "version": version]
1414

15+
// Thread-safe write using a barrier block on a concurrent queue.
16+
// Ensures no other reads or writes happen during this insertion.
1517
syncQueue.async(flags: .barrier) {
1618
extraPackages.insert(newPackage)
1719
}
@@ -20,6 +22,9 @@ import Foundation
2022
@objc
2123
public static func getPackages() -> NSMutableSet {
2224
var copy: Set<[String: String]> = []
25+
// Thread-safe synchronous read on a concurrent queue.
26+
// Multiple reads can happen concurrently unless a write barrier is active.
27+
// Returns a copy to prevent external mutation of internal state.
2328
syncQueue.sync {
2429
copy = extraPackages
2530
}

0 commit comments

Comments
 (0)