docs: demonstrate cooperative Endor tasks and pending await scope
Verify Tessera GUI / verify (push) Failing after 9m45s
Verify Tessera GUI / verify (push) Failing after 9m45s
This commit is contained in:
@@ -560,3 +560,6 @@ The lazy shared pool has four threads and a 64-job queue. Each runtime permits 1
|
||||
ui.fetchText(owner,key,url[,callback]) performs an asynchronous HTTP(S) GET using the same Task, owner/key replacement and success-only callback protocol as readText. Example: fetcher.fetch("http://127.0.0.1:4737/agent") after loading examples/async-network.endor. The example retains the complete result in fetcher.response and displays completion status; it does not put arbitrary network content into a TextBlock, whose own 16 KiB limit is independent of the provider limit. Only 2xx responses produce a UTF-8 result; HTTP failures, invalid UTF-8, oversize bodies and transport errors set status() to failed with error(). It verifies HTTPS certificates, follows at most five HTTP(S) redirects, has a 10-second connect and 30-second total transfer timeout (starting when a worker takes the request), and bounds decoded text to 1 MiB without truncation. URLs are limited to 8192 bytes and must not contain credentials or control characters. This GET API does not accept request bodies, custom headers or authentication.
|
||||
|
||||
The current transport uses a separate system curl process per request (/usr/bin/curl on Unix, curl.exe on Windows); missing or incompatible curl fails the Task. User curlrc and URL globbing are disabled; URL data is passed through escaped stdin configuration rather than command arguments. TLS and normal system proxy behavior remain enabled. Cancellation kills an active HTTP process immediately and the provider worker reaps it; the VM thread never waits for the process. All file and HTTP requests share the per-runtime 16-task limit and global four-worker/64-job queue. In-progress file reads remain cooperatively cancelled at delivery. Network access is not a security sandbox, and this is a text GET provider rather than a general HTTP client. Await/coroutines remain unfinished.
|
||||
|
||||
|
||||
ui.spawn(owner,key,function) creates an owner-scoped cooperative Task for a zero-argument Unit function. Each owning VM poll resumes at most a 256-instruction quantum per selected Task, rotates runnable tasks fairly, and retains source frames in an Aster-managed coroutine edge. Calls and writes may interleave between quanta; prior writes are not rolled back on cancellation or error. Pending/running Task replacement, owner closure, GC and reset release parked frames through the same managed graph. Native calls remain atomic and all quanta share the 128-frame/100000-instruction callback limit; a native entry may run during preparation. result() is unavailable until spawn completes. A source error still stops the shared runtime. See examples/cooperative-tasks.endor. This is independently resumable execution, not await: waiting on an I/O Task, Endor async/await syntax and await error propagation remain unfinished.
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
class CooperativeWork {
|
||||
steps: Object
|
||||
function run(self: CooperativeWork): Unit {
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
self.steps.increment()
|
||||
}
|
||||
}
|
||||
left = CooperativeWork(ui.state(0))
|
||||
right = CooperativeWork(ui.state(0))
|
||||
leftTask = ui.spawn(left,"work",left.run)
|
||||
rightTask = ui.spawn(right,"work",right.run)
|
||||
leftStatus = TextBlock("")
|
||||
rightStatus = TextBlock("")
|
||||
leftStatus.bind("text",leftTask.status)
|
||||
rightStatus.bind("text",rightTask.status)
|
||||
page = Page()
|
||||
page.title = "独立暂停调用"
|
||||
page.render(Column(24,16,TextBlock("两个任务分别保存执行帧;在 REPL 查看 left.steps.value / right.steps.value",2),leftStatus,rightStatus))
|
||||
@@ -217,3 +217,6 @@ The lazy shared pool has four threads and a 64-job queue. Each runtime permits 1
|
||||
ui.fetchText(owner,key,url[,callback]) performs an asynchronous HTTP(S) GET using the same Task, owner/key replacement and success-only callback protocol as readText. Example: fetcher.fetch("http://127.0.0.1:4737/agent") after loading examples/async-network.endor. The example retains the complete result in fetcher.response and displays completion status; it does not put arbitrary network content into a TextBlock, whose own 16 KiB limit is independent of the provider limit. Only 2xx responses produce a UTF-8 result; HTTP failures, invalid UTF-8, oversize bodies and transport errors set status() to failed with error(). It verifies HTTPS certificates, follows at most five HTTP(S) redirects, has a 10-second connect and 30-second total transfer timeout (starting when a worker takes the request), and bounds decoded text to 1 MiB without truncation. URLs are limited to 8192 bytes and must not contain credentials or control characters. This GET API does not accept request bodies, custom headers or authentication.
|
||||
|
||||
The current transport uses a separate system curl process per request (/usr/bin/curl on Unix, curl.exe on Windows); missing or incompatible curl fails the Task. User curlrc and URL globbing are disabled; URL data is passed through escaped stdin configuration rather than command arguments. TLS and normal system proxy behavior remain enabled. Cancellation kills an active HTTP process immediately and the provider worker reaps it; the VM thread never waits for the process. All file and HTTP requests share the per-runtime 16-task limit and global four-worker/64-job queue. In-progress file reads remain cooperatively cancelled at delivery. Network access is not a security sandbox, and this is a text GET provider rather than a general HTTP client. Await/coroutines remain unfinished.
|
||||
|
||||
|
||||
ui.spawn(owner,key,function) creates an owner-scoped cooperative Task for a zero-argument Unit function. Each owning VM poll resumes at most a 256-instruction quantum per selected Task, rotates runnable tasks fairly, and retains source frames in an Aster-managed coroutine edge. Calls and writes may interleave between quanta; prior writes are not rolled back on cancellation or error. Pending/running Task replacement, owner closure, GC and reset release parked frames through the same managed graph. Native calls remain atomic and all quanta share the 128-frame/100000-instruction callback limit; a native entry may run during preparation. result() is unavailable until spawn completes. A source error still stops the shared runtime. See examples/cooperative-tasks.endor. This is independently resumable execution, not await: waiting on an I/O Task, Endor async/await syntax and await error propagation remain unfinished.
|
||||
|
||||
@@ -1515,6 +1515,9 @@ ui.fetchText(owner,key,url[,callback]) performs an asynchronous HTTP(S) GET usin
|
||||
|
||||
The current transport uses a separate system curl process per request (/usr/bin/curl on Unix, curl.exe on Windows); missing or incompatible curl fails the Task. User curlrc and URL globbing are disabled; URL data is passed through escaped stdin configuration rather than command arguments. TLS and normal system proxy behavior remain enabled. Cancellation kills an active HTTP process immediately and the provider worker reaps it; the VM thread never waits for the process. All file and HTTP requests share the per-runtime 16-task limit and global four-worker/64-job queue. In-progress file reads remain cooperatively cancelled at delivery. Network access is not a security sandbox, and this is a text GET provider rather than a general HTTP client. Await/coroutines remain unfinished.
|
||||
|
||||
ui.spawn(owner,key,function) creates an owner-scoped cooperative Task for a zero-argument Unit function. Each owning VM poll resumes at most a 256-instruction quantum per selected Task, rotates runnable tasks fairly, and retains source frames in an Aster-managed coroutine edge. Calls and writes may interleave between quanta; prior writes are not rolled back on cancellation or error. Pending/running Task replacement, owner closure, GC and reset release parked frames through the same managed graph. Native calls remain atomic and all quanta share the 128-frame/100000-instruction callback limit; a native entry may run during preparation. result() is unavailable until spawn completes. A source error still stops the shared runtime. See examples/cooperative-tasks.endor. This is independently resumable execution, not await: waiting on an I/O Task, Endor async/await syntax and await error propagation remain unfinished.
|
||||
|
||||
|
||||
|
||||
## UI host object
|
||||
|
||||
|
||||
Reference in New Issue
Block a user