How does Task.checkCancellation knows task?

Please consider below code , How does swift knows which task is cancelled because
we are checking checkCancellation using Task's
public static func checkCancellation() throws
method and Task.isCancelled ?

when we are cancelling task1 how does i get cancellation status true in task1 closure but not in task2 even it is static property ?

I hope I am able to explain

    let task1 = Task {
            print("Task 1 started")
            
            try Task.checkCancellation() // How does Task knows that cancelled task is this one not the task2 ?
            
            print("Task 1 Finished")
            
        }
        
        let task2 = Task {
            print("Task 2 started")
            
            try Task.checkCancellation()  // How does Task knows that cancelled task is this one not the task1 ? 
            
            print("Task 2 Finished")
        }
        Task {
            do {
                try task1.cancel()
            } catch {
                print("Task 1 cancelled")
            }
        }
        Task {
            do {
                try task2.cancel()
            } catch {
                print("Task 2 cancelled")
            }
        }
  public static func checkCancellation() throws {
    if Task<Never, Never>.isCancelled {
      throw _Concurrency.CancellationError()
    }
  }s

and

  public static var isCancelled: Bool {
     unsafe withUnsafeCurrentTask { task in
       unsafe task?.isCancelled ?? false
     }
  }

and then you can check how it obtains the current task: swift/stdlib/public/Concurrency/Task.swift at e2120932b0d2a78b1dc6d9f6845e256a5a63e5d7 · swiftlang/swift · GitHub