Paul Rubin <no.e...@nospam.invalid> writes:
> Oh, neat! But the doc doesn't seem to describe the cooperative
> multitasker.
On reading the doc, it looks like the same words can control both
multitaskers, though some of them are only important for the preemptive
case.
The "Special User Variables" section has the confusing paragraph
Define a per-thread deferred word wait for all spawned tasks to
complete wait for a worker to become free, and spawn xt there wait
for a worker to become free, and spawn xt there, with one argument
wait for a worker to become free, and spawn xt there, with two
arguments
It looks there are some word headings missing from the middle of that by
accident. They seem to be for dealing with worker thread pools. Should
those really be primitives?
Are there parameters for the size of the event queue per task? What
happens if a queue fills up? Is the event queue system as described in
the doc part of a standardization proposal?
I find the event queue doc a bit confusing. Does event: let you give
arbitrary Forth code that is supposed to be executed in the receiving
task, i.e. something like an xt gets passed through the queue? If yes,
the doc should say so, and say how to pass an xt. Or is the definition
just supposed to be the events like elit, and friends? Do you use elit,
if you want to send an xt?
I expect it is the latter, and a typical event sequence would pass some
args and an event type. The receiving task would CASE on the event type
where each branch of the CASE would use the args for that type of event.
Does that sound right? But in that case why does EVENT: exist, instead
of using an ordinary colon definition? Why is there a maximum of 256
named events?
And if it is the former, how does one send a named event to another
task?
There are various defining words like event: which take names and create
objects with those names. Do they have factors that let you create the
objects anonymously?
It sounds like the event queue stuff might be gforth-specific, rather
than proposed or contemplated for standardization. That's fine, but it
would be nice if the doc identified words whose semantics might become
part of the standard.
I'm still interested in using this stuff on small MCU's (16KB program
flash, 1KB or 2KB ram), so I'm trying to figure out the resource
requirements of this multitasking scheme.