Clocks and scheduled tasks. Provides functions for getting the current time and running functions (Tasks) at specific times and periods. Includes a threadpool for task execution, controlled by (start!) and (stop!).
Clocks and scheduled tasks. Provides functions for getting the current time and running functions (Tasks) at specific times and periods. Includes a threadpool for task execution, controlled by (start!) and (stop!).
(after! delay f)
Calls f after delay seconds
Calls f after delay seconds
(defer this new-time)
Schedule a task for a new time.
Schedule a task for a new time.
(every! interval f)
(every! interval delay f)
Calls f every interval seconds, after delay.
Calls f every interval seconds, after delay.
(linear-time-real)
A current time on a linear scale with no fixed epoch; counts in seconds. Unlike unix-time, which can pause, skip, or flow backwards, advances consistently at (close) to wall clock time.
A current time on a linear scale with no fixed epoch; counts in seconds. Unlike unix-time, which can pause, skip, or flow backwards, advances consistently at (close) to wall clock time.
(next-tick anchor dt)
(next-tick anchor dt now)
Given a period dt, beginning at some point in time anchor, finds the next tick after time now, such that the next tick is separate from anchor by an exact multiple of dt. If now is omitted, defaults to (unix-time).
Given a period dt, beginning at some point in time anchor, finds the next tick after time now, such that the next tick is separate from anchor by an exact multiple of dt. If now is omitted, defaults to (unix-time).
(poll-task!)
Removes the next task from the queue.
Removes the next task from the queue.
(reset-tasks!)
Resets the task queue to empty, without triggering side effects.
Resets the task queue to empty, without triggering side effects.
(run-tasks! i)
While running, takes tasks from the queue and executes them when ready. Will park the current thread when no tasks are available.
While running, takes tasks from the queue and executes them when ready. Will park the current thread when no tasks are available.
(schedule! task)
Schedule a task. May awaken a thread from the threadpool to investigate.
Schedule a task. May awaken a thread from the threadpool to investigate.
(schedule-sneaky! task)
Schedules a task. Does not awaken any threads.
Schedules a task. Does *not* awaken any threads.
(start!)
Starts the threadpool to execute tasks on the queue automatically.
Starts the threadpool to execute tasks on the queue automatically.
(stop!)
Stops the task threadpool. Waits for threads to exit.
Stops the task threadpool. Waits for threads to exit.
(cancel task)
Cancel this task.
Cancel this task.
(run task)
Executes this task.
Executes this task.
(succ task)
The successive task to this one.
The successive task to this one.
(unix-time-real)
The current unix epoch time in seconds, taken from System/currentTimeMillis.
The current unix epoch time in seconds, taken from System/currentTimeMillis.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close