Add archive helpers and harden task runtime
This commit is contained in:
@@ -2,21 +2,26 @@
|
||||
pid_t task_repeat(String key, f64 interval, std::function<void()> exec_func, u64 timeout = 60*10)
|
||||
|
||||
:params
|
||||
key : string uniquely identifying the task
|
||||
key : string uniquely identifying the task across the whole runtime instance
|
||||
interval : repeat interval in seconds
|
||||
exec_func : function to execute repeatedly
|
||||
timeout : optional task timeout value
|
||||
return value : the process ID of the started (or still running) task
|
||||
timeout : maximum run time in seconds; `0` disables the timeout
|
||||
return value : the process ID of the started (or still running) task, or `0` when the task could not be started
|
||||
|
||||
:see
|
||||
>task
|
||||
task
|
||||
task_pid
|
||||
task_kill
|
||||
|
||||
:content
|
||||
Starts a repeating background worker process.
|
||||
|
||||
`exec_func` runs in a loop, and the worker sleeps for `interval` seconds between executions.
|
||||
`exec_func` runs in a loop, and the worker sleeps for `interval` seconds between executions. `interval` must be greater than zero.
|
||||
|
||||
If a process with the same `key` is already running, `task_repeat()` does not start a second worker and instead returns the PID of the existing one.
|
||||
If a process with the same `key` is already running anywhere in the runtime instance, `task_repeat()` does not start a second worker and instead returns the PID of the existing one. Coordination is through the same shared task state used by `task()`.
|
||||
|
||||
`timeout` bounds the lifetime of the repeating worker. The default is ten minutes. Pass `0` only for intentionally unbounded workers with another shutdown path.
|
||||
|
||||
Related:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user