mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-06-24 12:21:58 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user