Documentation
¶
Overview ¶
Package workermod is the native module "worker": workers are Kukel interpreters that run in parallel, each on its own goroutine, and talk to the interpreter that started them only through messages.
use worker;
square(id) { // runs in the worker
for (local m = worker::receive(); m != nil; m = worker::receive())
worker::send([id, m * m]);
}
main() {
local w = worker::start(square, 1); // or worker::startfile("sq.kkl", ...)
w->send(7);
println(w->receive()); // [1, 49]
w->stop(); // the worker's receive() gives nil
w->wait();
}
Interpreters share nothing: a message is a copy, made by the sender, of a boolean, a number, a string, or vectors and maps of those (and nil inside them; nil itself cannot be sent, receive gives it at the end).
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Worker = &native.Class{Name: "Worker"}
Worker is the class worker::Worker: the parent's handle of a worker.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.