Skip to content

Commit 8e7f057

Browse files
author
Ignacio Bonafonte
authored
Merge pull request #234 from open-telemetry/fix-compiling-Xcode-13-RC
2 parents 742132f + 9d4492e commit 8e7f057

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Sources/OpenTelemetryApi/Context/ActivityContextManager.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ private let OS_ACTIVITY_CURRENT = unsafeBitCast(dlsym(UnsafeMutableRawPointer(bi
1616

1717
class ActivityContextManager: ContextManager {
1818
static let instance = ActivityContextManager()
19-
#if swift(>=5.5)
19+
#if canImport(_Concurrency)
2020
@available(macOS 12.0, iOS 15.0, tvOS 15.0, *)
2121
static let taskLocalContextManager = TaskLocalContextManager.instance
22-
#endif
22+
#endif
2323

2424
let rlock = NSRecursiveLock()
2525

@@ -38,14 +38,14 @@ class ActivityContextManager: ContextManager {
3838
var contextMap = [os_activity_id_t: [String: AnyObject]]()
3939

4040
func getCurrentContextValue(forKey key: OpenTelemetryContextKeys) -> AnyObject? {
41-
#if swift(>=5.5)
41+
#if canImport(_Concurrency)
4242
if #available(macOS 12.0, iOS 15.0, tvOS 15.0, *) {
4343
// If running with task local, use first its stored value
4444
if let contextValue = ActivityContextManager.taskLocalContextManager.getCurrentContextValue(forKey: key) {
4545
return contextValue
4646
}
4747
}
48-
#endif
48+
#endif
4949
var parentIdent: os_activity_id_t = 0
5050
let activityIdent = os_activity_get_identifier(OS_ACTIVITY_CURRENT, &parentIdent)
5151
var contextValue: AnyObject?
@@ -70,12 +70,12 @@ class ActivityContextManager: ContextManager {
7070
objectScope.setObject(ScopeElement(scope: scope), forKey: value)
7171
}
7272
contextMap[activityIdent]?[key.rawValue] = value
73-
#if swift(>=5.5)
73+
#if canImport(_Concurrency)
7474
if #available(macOS 12.0, iOS 15.0, tvOS 15.0, *) {
7575
// If running with task local, set the value after the activity, so activity is not empty
7676
ActivityContextManager.taskLocalContextManager.setCurrentContextValue(forKey: key, value: value)
7777
}
78-
#endif
78+
#endif
7979
rlock.unlock()
8080
}
8181

@@ -94,14 +94,14 @@ class ActivityContextManager: ContextManager {
9494
os_activity_scope_leave(&scope)
9595
objectScope.removeObject(forKey: value)
9696
}
97-
#if swift(>=5.5)
97+
#if canImport(_Concurrency)
9898
if #available(macOS 12.0, iOS 15.0, tvOS 15.0, *) {
9999
// If there is a parent activity, set its content as the task local
100100
ActivityContextManager.taskLocalContextManager.removeContextValue(forKey: key, value: value)
101101
if let currentContext = self.getCurrentContextValue(forKey: key) {
102102
ActivityContextManager.taskLocalContextManager.setCurrentContextValue(forKey: key, value: currentContext)
103103
}
104104
}
105-
#endif
105+
#endif
106106
}
107107
}

Sources/OpenTelemetryApi/Context/TaskLocalContextManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import Foundation
77

8-
#if swift(>=5.5)
8+
#if canImport(_Concurrency)
99
@available(macOS 12.0, iOS 15.0, tvOS 15.0, *)
1010
enum ContextManagement {
1111
@TaskLocal

0 commit comments

Comments
 (0)