Skip to content

Instantly share code, notes, and snippets.

View dehesa's full-sized avatar
🐙

Marcos Sánchez-Dehesa dehesa

🐙
View GitHub Profile
@dehesa
dehesa / TaskProgression.swift
Last active September 3, 2024 18:22
Experimental mechanism to track progressions on Swift 6 concurrency.
/// Gathers progression information of all computations within the `operation` block.
///
/// This free function sets the `@TaskLocal` value `Task.unsafeProgress`, which serves as an
/// indicator to any task in the structure concurrency tree to start gathering progression information.
/// Functions supporting _progress_ will forward such data into the `progress` handler.
///
/// ## Features
/// - Progress data forwarding to the `progress` handler.
/// - No locks (and no thread hopping).
/// - Supports concurrent operations.