Task
zune.task
A library to interact with the task scheduler.
Functions
cancel
Cancels a task, and resets thread.
cancel(thread: thread): ()Parameters
thread: thread- The thread to cancel.
defer
Runs function or thread on end of scheduler frame.
defer(f: ((A...) -> R...) | thread, A...): threadParameters
f: ((A...) -> R...) | thread- The function to defer.A...- The arguments to pass to the function.
delay
Runs function or thread after a certain amount of time.
delay(sec: number, f: ((A...) -> (R...)) | thread, A...): threadParameters
sec: number- The amount of time to delay.f: ((A...) -> (R...)) | thread- The function to run after the delay.A...- The arguments to pass to the function.
spawn
Runs function or thread immediately.
spawn(f: ((A...) -> (R...)) | thread, A...): threadParameters
f: ((A...) -> (R...)) | thread- The function to run immediately.A...- The arguments to pass to the function.
wait
Yields and resumes current calling thread after a certain amount of time, returning the total time the sleep took.
wait(sec: number?): numberParameters
sec: number?- The amount of time to sleep.
count
Counts the number of current tasks.
Optional kinds parameter to count a specific kind of task.
Kinds:
sto count sleeping tasks.dto count deferred tasks.wto count awaiting tasks. (zune backend)tto count internal tasks. (zune backend)
count(): number
count(kinds: string): ...numberParameters
kinds: string?- The kinds of tasks to count.nilto count all kinds.- default:
nil
- default:
Throws
- Error
Last updated on