@@ -291,23 +291,23 @@ extension Task: Equatable {
291291}
292292
293293// ==== -----------------------------------------------------------------------
294- // MARK: Task Identifier
294+ // MARK: Task ID
295295
296296/// An opaque, process-unique identifier for a Swift ``Task``.
297297///
298- /// A `TaskIdentifier ` is assigned at task creation, never changes for the
299- /// lifetime of the task, and is never reused once a task has completed.
300- /// Identifiers are scoped to the current process and are not suitable for
301- /// cross-process correlation.
298+ /// A `TaskID ` is assigned at task creation, never changes for the lifetime
299+ /// of the task, and is never reused once a task has completed. IDs are
300+ /// scoped to the current process and are not suitable for cross-process
301+ /// correlation.
302302///
303- /// Reading the identifier of the currently-executing task is fast.
303+ /// Reading the ID of the currently-executing task is fast.
304304///
305- /// - See : ``Task/currentIdentifier ``
306- /// - See : ``Task/identifier ``
307- /// - See : ``UnsafeCurrentTask/identifier ``
305+ /// - SeeAlso : ``Task/currentID ``
306+ /// - SeeAlso : ``Task/id ``
307+ /// - SeeAlso : ``UnsafeCurrentTask/id ``
308308@available ( StdlibDeploymentTarget 6 . 5 , * )
309309@frozen
310- public struct TaskIdentifier : Sendable , Hashable {
310+ public struct TaskID : Sendable , Hashable {
311311 @usableFromInline
312312 internal var _rawValue : UInt64
313313
@@ -316,21 +316,21 @@ public struct TaskIdentifier: Sendable, Hashable {
316316 self . _rawValue = _rawValue
317317 }
318318
319- /// The raw 64-bit value of this identifier .
319+ /// The raw 64-bit value of this ID .
320320 ///
321321 /// This is the only escape hatch from the opaque type and is intended for
322322 /// serialization, logging, or interop with tools that expect a numeric
323323 /// task ID. The numeric value carries no semantic meaning beyond the
324- /// guarantees on `TaskIdentifier ` itself.
324+ /// guarantees on `TaskID ` itself.
325325 @_alwaysEmitIntoClient
326326 public var rawValue : UInt64 { _rawValue }
327327}
328328
329329@available ( StdlibDeploymentTarget 6 . 5 , * )
330330extension Task {
331- /// A type alias for ``TaskIdentifier ``, providing the spelling
332- /// `Task.Identifier ` at the use site.
333- public typealias Identifier = TaskIdentifier
331+ /// A type alias for ``TaskID ``, providing the spelling
332+ /// `Task.ID ` at the use site.
333+ public typealias ID = TaskID
334334}
335335
336336// ==== Task Priority ----------------------------------------------------------
@@ -482,27 +482,23 @@ extension Task where Success == Never, Failure == Never {
482482 }
483483 }
484484
485- /// The stable identifier of the currently-executing task.
485+ /// The stable ID of the currently-executing task.
486486 ///
487487 /// If you access this static property outside the execution context of a
488488 /// task, it will return `nil`.
489489 ///
490- /// This identifier is quick to obtain and can be used to reliably identify
491- /// a task, instead of its memory address which may be reused once the task
490+ /// This ID is quick to obtain and can be used to reliably identify a
491+ /// task, instead of its memory address which may be reused once the task
492492 /// has been destroyed. No guarantees are made about its exact numeric
493493 /// value.
494494 ///
495- /// - SeeAlso: ``Task/identifier ``
496- /// - SeeAlso: ``UnsafeCurrentTask/identifier ``
495+ /// - SeeAlso: ``Task/id ``
496+ /// - SeeAlso: ``UnsafeCurrentTask/id ``
497497 @available ( StdlibDeploymentTarget 6 . 5 , * )
498498 @_alwaysEmitIntoClient
499- public static var currentIdentifier : Task . Identifier ? {
500- // Direct runtime call: reads the id on the current AsyncTask without
501- // ever surfacing the task reference to Swift, so there's no ARC dance.
502- // The runtime returns 0 when there is no current task; task IDs are
503- // guaranteed to be non-zero.
499+ public static var currentID : Task . ID ? {
504500 let id = _getCurrentTaskId ( )
505- return id == 0 ? nil : TaskIdentifier ( _rawValue: id)
501+ return id == 0 ? nil : TaskID ( _rawValue: id)
506502 }
507503
508504}
@@ -710,22 +706,22 @@ extension Task {
710706 }
711707 }
712708
713- /// A stable identifier for this task.
709+ /// A stable ID for this task.
714710 ///
715- /// This identifier is quick to obtain and can be used to reliably identify
716- /// a task, instead of its memory address which may be reused once the task
711+ /// This ID is quick to obtain and can be used to reliably identify a
712+ /// task, instead of its memory address which may be reused once the task
717713 /// has been destroyed. No guarantees are made about its exact numeric
718714 /// value.
719715 ///
720- /// The same identifier is visible in tools such as `swift-inspect` and
716+ /// The same ID is visible in tools such as `swift-inspect` and
721717 /// Instruments, which makes it a convenient correlation key for tracing
722718 /// and logging.
723719 ///
724- /// - SeeAlso: ``Task/currentIdentifier ``
725- /// - SeeAlso: ``UnsafeCurrentTask/identifier ``
720+ /// - SeeAlso: ``Task/currentID ``
721+ /// - SeeAlso: ``UnsafeCurrentTask/id ``
726722 @available ( StdlibDeploymentTarget 6 . 5 , * )
727723 @_alwaysEmitIntoClient
728- public var identifier : Identifier {
724+ public var id : ID {
729725 unsafe . init (
730726 _rawValue: _getJobTaskId ( unsafeBitCast ( _task, to: UnownedJob . self) ) )
731727 }
@@ -987,21 +983,21 @@ public struct UnsafeCurrentTask {
987983 }
988984 }
989985
990- /// A stable identifier for the current task.
986+ /// A stable ID for the current task.
991987 ///
992- /// This identifier is quick to obtain and can be used to reliably identify
993- /// a task, instead of its memory address which may be reused once the task
988+ /// This ID is quick to obtain and can be used to reliably identify a
989+ /// task, instead of its memory address which may be reused once the task
994990 /// has been destroyed. No guarantees are made about its exact numeric
995991 /// value.
996992 ///
997- /// Returns the same value as ``Task/identifier `` read on the owning task.
993+ /// Returns the same value as ``Task/id `` read on the owning task.
998994 ///
999- /// - SeeAlso: ``Task/identifier ``
1000- /// - SeeAlso: ``Task/currentIdentifier ``
995+ /// - SeeAlso: ``Task/id ``
996+ /// - SeeAlso: ``Task/currentID ``
1001997 @available ( StdlibDeploymentTarget 6 . 5 , * )
1002998 @_alwaysEmitIntoClient
1003- public var identifier : Task . Identifier {
1004- unsafe TaskIdent ifier (
999+ public var id : Task . ID {
1000+ unsafe TaskID (
10051001 _rawValue: _getJobTaskId ( unsafeBitCast ( _task, to: UnownedJob . self) ) )
10061002 }
10071003}
0 commit comments