nupp.workers

Module contents

Types

TypeKindDescription
Scopeinterface
ScopeTokeninterfaceThe cleanup contract a structured worker scope carries.
SubmittabletypeWhat may actually be submitted: a module member, or an outlined literal whose effectively-final captures can be...
TasktypeThe typed handle for one submitted function.

Types#

Scopeinterface#

interface Scope is workers.ScopeToken
    readonly spawn: function<F is workers.Submittable>(
        borrows self: Scope,
        F,
        ...: unpackof workers.Submitted(F)
    ): workers.Task<F>
    readonly close: function(borrows self: Scope): nil
    readonly drop: function(takes self: Scope): nil
end

Methods

spawn#
spawn: function<F is workers.Submittable>(
    borrows self: workers.PublicScope,
    F,
    ...: unpackof workers.Submitted(F)
): workers.Task<F>
Arguments
NameTypeDescription
borrows selfworkers.PublicScope
?F
...unpackof workers.Submitted(F)
Returns
TypeDescription
workers.Task<F>
close#
close: function(borrows self: workers.PublicScope): nil
Arguments
NameTypeDescription
borrows selfworkers.PublicScope
Returns
TypeDescription
nil
drop#
drop: function(takes self: workers.PublicScope): nil
Arguments
NameTypeDescription
takes selfworkers.PublicScope
Returns
TypeDescription
nil

ScopeTokeninterface#

affine interface ScopeToken
    terminal readonly drop: function(takes self: ScopeToken): nil
end

The cleanup contract a structured worker scope carries.

Methods

drop#
drop: function(takes self: workers.ScopeToken): nil
Arguments
NameTypeDescription
takes selfworkers.ScopeToken
Returns
TypeDescription
nil

Submittabletype#

type Submittable = sendable function(...: any): any

What may actually be submitted: a module member, or an outlined literal whose effectively-final captures can be copied to another lane. Exported so a task scope can hold its fork to the same bound without linking this module.

Tasktype#

type Task<F is Callable> = TaskType(F)

The typed handle for one submitted function.

Type parameters

NameDescription
F