OSSignpostID
An identifier you use to distinguish between signposts that have the same name and destination log.
So, since for that, OSSignpostID has a unique identifier in backing. We can see that value with prints OSSignpostID. I've printed several kind of IDs.
import os
print(OSSignpostID.exclusive)
print(OSSignpostID.exclusive)
print(OSSignpostID.exclusive)
let log1 = OSLog(subsystem: "app.muukii", category: "performance1")
let log2 = OSLog(subsystem: "app.muukii2", category: "performance2")
print(OSSignpostID(log: log1))
print(OSSignpostID(log: log1))
print(OSSignpostID(log: log1))
print(OSSignpostID(log: log1))
print(OSSignpostID(log: log2))
OSSignpostID(rawValue: 17216892719917625070)
OSSignpostID(rawValue: 17216892719917625070)
OSSignpostID(rawValue: 17216892719917625070)
OSSignpostID(rawValue: 1)
OSSignpostID(rawValue: 2)
OSSignpostID(rawValue: 3)
OSSignpostID(rawValue: 4)
OSSignpostID(rawValue: 5)
exclusive
always print the same value. Because it is static let variable. that makes sense.
On the other hand, OSSignpostID(log: log1)
creates a unique value each created. (it seems the value is incremented)
DispatchQueue.concurrentPerform(iterations: 1000) { (i) in
print(OSSignpostID(log: log1))
}
What if we create the ID concurrently, that initializer works fine. The backing identifiers are incremented atomically.