Executor composition for Swift. Provides sharded executor pools for parallel work dispatch using Kernel.Thread.Executor instances from swift-kernel. Layer 3 (Foundations) of the Swift Institute five-layer architecture.
- Sharded executor pools -- Round-robin distribution across N serial executors
- Typed throws -- No
any Errorat the API surface - Foundation-free -- No Foundation module dependencies
- Swift 6 strict concurrency -- Full
Sendablecompliance
dependencies: [
.package(url: "https://github.com/swift-foundations/swift-executors.git", branch: "main")
]Pre-1.0: no version tags yet. APIs may change; pin a commit for reproducible builds.
.target(
name: "YourTarget",
dependencies: [
.product(name: "Executors", package: "swift-executors")
]
)- Swift 6.2+
- macOS 26.0+ / iOS 26.0+ / tvOS 26.0+ / watchOS 26.0+
- Linux (Ubuntu 22.04+)
- Windows (Swift 6.2+)
import Executors
let pool = Kernel.Thread.Executor.Sharded(.init(count: 4))
defer { pool.shutdown() }
let executor = pool.next()
// Use executor for task dispatch or actor pinning| Type | Purpose |
|---|---|
Kernel.Thread.Executor.Sharded |
Sharded pool of serial executors with round-robin routing |
Kernel.Thread.Executor.Sharded.Options |
Configuration for thread count |
swift-executors sits at Layer 3 (Foundations), depending on swift-kernel for Kernel.Thread.Executor.
swift-executors <-- Executor composition (this package)
|
swift-kernel <-- Serial executor, OS thread primitives
|
swift-kernel-primitives <-- Syscall vocabulary
- swift-kernel: Serial executors backed by dedicated OS threads
- swift-io: Async I/O executor with typed throws
Apache 2.0 -- See LICENSE for details.