Relax atomic memory orderings; switch semaphore to release/acquire

For ID counters and standalone flags (most sites), drop to .relaxed
since nothing reads other memory based on the atomic's value.

MultiEntrySemaphore.signaled is the exception: it is used as a
signal/wait primitive where waiters proceed to use state set up
before signal(). Use .releasing on store and .acquiring on load so
that pre-signal writes are visible to waiters that observe `true`.
.relaxed there would be incorrect on weakly-ordered architectures.
This commit is contained in:
Rintaro Ishizaki
2026-05-21 11:16:17 -07:00
parent 83de30d29f
commit a6c926fa34
9 changed files with 19 additions and 19 deletions
@@ -125,7 +125,7 @@ public final class InProcessSourceKitLSPClient: Sendable {
reply: @Sendable @escaping (LSPResult<R.Response>) -> Void
) -> RequestID {
let requestID = RequestID.string(
"sk-\(Int(nextRequestID.wrappingAdd(1, ordering: .sequentiallyConsistent).oldValue))"
"sk-\(Int(nextRequestID.wrappingAdd(1, ordering: .relaxed).oldValue))"
)
server.handle(request, id: requestID, reply: reply)
return requestID