stdlib/taskView source ↗
task
20 items · generated by scribe fromstdlib/task.fd· synced 2026-11-15
Contents
- task_go (function)
- task_yield (function)
- task_run (function)
- task_sleep (function)
- task_wait_read (function)
- task_wait_write (function)
- task_detach (function)
- task_done (function)
- task_result (function)
- task_pool_call (function)
- TaskScope (struct)
- task_scope_new (function)
- task_scope_go (function)
- task_scope_flag_ptr (function)
- task_scope_cancelled (function)
- task_scope_cancel (function)
- task_join_timeout (function)
- task_scope_join (function)
- task_scope_cancel_join (function)
- task_timeout (function)
task_go
Start the function name, which takes one i64, as a task. It starts on a worker as soon as one is free. Returns the task.
pub fn task_go(name: str, arg: i64) -> i64 {Parameters:
name:strarg:i64
Returns: i64
Defined at line 21
task_yield
Let the other tasks run. Outside a task it does nothing.
pub fn task_yield() -> void {Returns: void
Defined at line 26
task_run
Wait until every task has finished, tasks they start included. Returns how many tasks there have been.
pub fn task_run() -> i64 {Returns: i64
Defined at line 32
task_sleep
Let ms milliseconds pass; the other tasks run meanwhile.
pub fn task_sleep(ms: i64) -> void {Parameters:
ms:i64
Returns: void
Defined at line 37
task_wait_read
Wait until the socket fd has data, at most timeout_ms (-1: no limit). The other tasks run meanwhile. Returns false on a timeout.
pub fn task_wait_read(fd: i64, timeout_ms: i64) -> bool {Parameters:
fd:i64timeout_ms:i64
Returns: bool
Defined at line 43
task_wait_write
Wait until the socket fd can take data, at most timeout_ms (-1: no limit).
pub fn task_wait_write(fd: i64, timeout_ms: i64) -> bool {Parameters:
fd:i64timeout_ms:i64
Returns: bool
Defined at line 48
task_detach
Nobody will read this task’s result: free it when it finishes.
pub fn task_detach(t: i64) -> void {Parameters:
t:i64
Returns: void
Defined at line 53
task_done
True once the task has finished.
pub fn task_done(t: i64) -> bool {Parameters:
t:i64
Returns: bool
Defined at line 58
task_result
What the task returned.
pub fn task_result(t: i64) -> i64 {Parameters:
t:i64
Returns: i64
Defined at line 63
task_pool_call
Run the program function name (same signature rules as spawn targets) on the scheduler’s blocking-call pool while this task parks. For wrapping syscalls that can neither be polled nor made nonblocking. Off a task it just calls the function. args is an i64 array of arguments; returns what the function returned.
pub fn task_pool_call(name: str, nargs: i64, args: i64) -> i64 {Parameters:
name:strnargs:i64args:i64
Returns: i64
Defined at line 72
TaskScope
A group of tasks started together, joined together.
pub struct TaskScope {Fields:
| Name | Type |
|---|---|
tasks | Vec<i64> |
flag | i64 |
Defined at line 91
task_scope_new
An empty scope.
pub fn task_scope_new() -> TaskScope {Returns: TaskScope
Defined at line 98
task_scope_go
Start name(arg) as a child of the scope.
pub fn task_scope_go(s: & mut TaskScope, name: str, arg: i64) -> i64 {Parameters:
s:& mut TaskScopename:strarg:i64
Returns: i64
Defined at line 105
task_scope_flag_ptr
The scope’s cancel flag as an i64 address: hand it to a child’s arg (or pack it into a struct) so the child can poll sync_atomic_load(flag_ptr) != 0 and stop early.
pub fn task_scope_flag_ptr(s: & TaskScope) -> i64 {Parameters:
s:& TaskScope
Returns: i64
Defined at line 114
task_scope_cancelled
True once someone cancelled the scope. Children poll this.
pub fn task_scope_cancelled(s: & TaskScope) -> bool {Parameters:
s:& TaskScope
Returns: bool
Defined at line 119
task_scope_cancel
Ask every child (cooperatively) to stop. Does not wait.
pub fn task_scope_cancel(s: & mut TaskScope) -> void {Parameters:
s:& mut TaskScope
Returns: void
Defined at line 124
task_join_timeout
Wait until the task finishes, at most ms (-1: no limit). Returns its result, or -1 on a timeout; the task keeps running. Poll granularity is ~1 ms.
pub fn task_join_timeout(t: i64, ms: i64) -> i64 {Parameters:
t:i64ms:i64
Returns: i64
Defined at line 131
task_scope_join
Wait for every child of the scope. Returns the results in spawn order. Children that spawned more children are covered too: task_run drains the scheduler before the per-handle results are read.
pub fn task_scope_join(s: & mut TaskScope) -> Vec<i64> {Parameters:
s:& mut TaskScope
Returns: Vec<i64>
Defined at line 151
task_scope_cancel_join
Cancel the scope, then wait for every child to observe the flag and end. Returns the results of children that finished (spawn order; a child that ignores cancellation still has its result once it ends).
pub fn task_scope_cancel_join(s: & mut TaskScope) -> Vec<i64> {Parameters:
s:& mut TaskScope
Returns: Vec<i64>
Defined at line 165
task_timeout
Run name(arg) as a task and wait at most ms for it. Returns the result, or -1 on a timeout (the task keeps running).
pub fn task_timeout(name: str, arg: i64, ms: i64) -> i64 {Parameters:
name:strarg:i64ms:i64
Returns: i64
Defined at line 172
Generated by scribe, the Fides documentation generator