An error that occurs when spawning a worker thread fails.
struct SpawnError
s19JavaScriptEventLoop21WebWorkerTaskExecutorC10SpawnErrorV
8NDA1
import JavaScriptEventLoop
final class WebWorkerTaskExecutor
A task executor that runs tasks on Web Worker threads.
init(numberOfThreads: Int, timeout: Duration = .seconds(3), checkInterval: Duration = .microseconds(5)) async throws
Creates a new Web Worker task executor with the specified number of worker threads.
static func installGlobalExecutor()
Installs a global executor that forwards jobs from Web Worker threads to the main thread.
var numberOfThreads: Int { get }
Returns the number of worker threads managed by this executor.
func enqueue(_ job: UnownedJob)
Enqueues a job to be executed by one of the worker threads.
func terminate()
Terminates all worker threads managed by this executor.
protocol Error : Sendable
A type representing an error value that can be thrown.
protocol Sendable
let reason: String
The reason for the error.