baml.spawn.TaskGroup

A logical group of green threads.

Reference version

Signature

class baml.spawn.TaskGroup

A logical group of green threads.

These have three primary purposes:

  • Task groups limit how many spawns referencing it run concurrently. Excess spawns queue FIFO and start as earlier ones settle; the spawn still returns its Future immediately, so queueing is invisible.
  • Shared cancellation: calling cancel on a group cancels all tasks in the group.
  • Debugging: task groups have an optional name and provide logical grouping of tasks.

Source:<builtin>/baml/ns_spawn/spawn.bamlbytes 16833150

Fields

_handle

$rust_type

Static methods

function

new

(limit: int, name: string | null = …) -> baml.spawn.TaskGroup throws never

Instance methods

function

active_count

(self) -> int throws never
function

cancel

(self, pending: bool | null = …, active: bool | null = …) -> int throws never
function

limit

(self) -> int throws never
function

name

(self) -> string | null throws never
function

queued_count

(self) -> int throws never
function

set_limit

(self, limit: int) -> void throws never

Implementations

baml.Concrete for T

Source:<builtin>/baml/core.bamlbytes 747779