Skip to content

Commit ee6e40e

Browse files
committed
Make the ID of a DelayedSigation be a UUID
This allows not keeping/using the latest ID generated around, which avoids a lock (because UUIDs can be considered guaranteed to be unique when generated).
1 parent cb92f51 commit ee6e40e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Sources/SignalHandling/DelayedSigaction/DelayedSigaction.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ import Foundation
77
Use the ID to unregister the delay. */
88
public struct DelayedSigaction : Hashable {
99

10-
private static var latestID = 0
11-
12-
internal var id: Int
10+
internal var id: UUID
1311
internal var signal: Signal
1412

1513
internal init(signal: Signal) {
16-
defer {Self.latestID += 1}
17-
self.id = Self.latestID
14+
self.id = .init()
1815
self.signal = signal
1916
}
2017

0 commit comments

Comments
 (0)