Skip to main content

Module ConcurrentTask

Module ConcurrentTask 

Source
Expand description

A task that runs concurrently in the work pool.

This is used to run tasks that are CPU-intensive or blocking on the work pool. It’s also used to run tasks that need to be run on a different thread than the main JavaScript thread.

The task is run on a thread pool and then the result is returned to the main JavaScript thread.

If auto_delete is true, the task is automatically deallocated when it’s finished. Otherwise, it’s expected that the containing struct will deallocate the task.

Modules§

task_tag
Tag constants for Task — one per variant of Zig’s jsc.Task TaggedPointerUnion (src/jsc/Task.zig). Values are sequential by source order; bun_runtime::dispatch::run_task matches on these. Both sides MUST agree — adding a variant requires updating both this list and the runtime match arm.

Structs§

ConcurrentTask
Task
TaskTag

Enums§

AutoDeinit

Traits§

Taskable
Type → tag binding for Task. Implement on every type that can be enqueued; the impl lives in whatever crate owns the type (mirrors Zig’s comptime TaggedPointerUnion type-list lookup, where the tag was derived from @typeName(std.meta.Child(@TypeOf(ptr)))).

Functions§

create
create_from
from_callback

Type Aliases§

Queue