Skip to content

Latest commit

 

History

History
107 lines (66 loc) · 2.54 KB

tasks.md

File metadata and controls

107 lines (66 loc) · 2.54 KB
description Khan API reference - thread runner tasks for executing threads, handling results, and thread lifecycle management.
layout
title description tableOfContents outline pagination
visible
true
visible
visible
true
visible
true
visible
true

Khan API Reference

These are the tasks Khan can be passed and the gifts it can give.

Tasks {#tasks}

Here are the tasks you can pass Khan. You'd either use %fard to run a thread from a file or %lard to run an in-line thread.

%fard {#fard}

Run a thread from within Arvo.

[%fard p=(fyrd cage)]

.p contains the thread location, name, and start arguments. See the +fyrd data type reference entry for details.

Returns

When the thread finishes, either by succeeding or failing, Khan will return an %arow gift.


%fyrd {#fyrd}

External thread.

[%fyrd p=(fyrd cast)]

This is passed to Khan by the runtime when a thread is run externally. You would not use this from userspace.


%lard {#lard}

In-line thread.

[%lard =bear =shed]

The $bear is either a $desk or $beak. The $shed is the thread itself. Since Spider doesn't need to read out the thread from Clay, the $bear doesn't do much apart from be included in the thread name that Spider generates. Khan will have Spider run the given thread, and eventually give an %arow gift back with the result.

Returns

When the thread eventually finishes (or if it fails), Khan with give an %arow gift back with the result.


%done {#done}

Socket closed.

[%done ~]

Tells Khan that the external control socket has closed. This comes from the runtime; you would not send it from userspace.

Gifts {#gifts}

These are the two gifts Khan can give. In userspace, you'd only receive an %arow.

%arow {#arow}

In-arvo result.

[%arow p=(avow cage)]

This gift contains the result of a finished thread if successful, or an error and stack trace if it failed. It's given for threads run from within Arvo. See the +avow entry in the types reference for more details.


%avow {#avow}

External result.

[%avow p=(avow page)]

This gift contains the result of running a thread externally. You would not receive this in userspace.

A $page is a pair of $mark and $noun. See the +avow entry in the types reference for more details of that mold builder.