Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the timer-wheel Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 06:01:08 2022 GMT+0.
Next: Systems, Previous: The timer-wheel Reference Manual, Up: The timer-wheel Reference Manual [Contents][Index]
A portable Common Lisp timer wheel implementation. A timer wheel provides an efficient mechanism to implement tick-based timer routines. The portable part of this is the backend using Boreaux Threads to run a background thread operating the wheel.
Note that this package uses the internal-real-time to manage inter-tick timing intervals. Thus the correctness of the interval depends on how the specific lisp implementation implements internal-real-time. For instance, SBCL currently uses gettimeofday internally which means that a leap-second can stop time.
For the original reference I used, see "Real-Time Embedded Systems" by Xiaocong Fan, chapter 22.3. For some background on timers in Linux
(asdf:load-system :timer-wheel.examples)
;; Increment and print a counter value every tick with two different counters.
;; A third counter triggers the completion of the test.
(tw.examples:test 100 1500)
I've tested on Windows with SBCL 1.3 and CCL 1.11. I could get a timer wheel running with a resolution of 20 milliseconds without overruns (Nothing else going on). If you start loading up the garbage collector, I'm guessing that you'll start getting overruns. Test to determine what works.
Next: Modules, Previous: Introduction, Up: The timer-wheel Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
A timer wheel implementation with BORDEAUX-THREADS backend.
Nick Patrick <npatrick04@gmail.com>
MIT
bordeaux-threads (system).
src (module).
Next: Files, Previous: Systems, Up: The timer-wheel Reference Manual [Contents][Index]
Modules are listed depth-first from the system components tree.
timer-wheel (system).
Next: Packages, Previous: Modules, Up: The timer-wheel Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: timer-wheel/src/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
timer-wheel (system).
Next: timer-wheel/src/utils.lisp, Previous: timer-wheel/timer-wheel.asd, Up: Lisp [Contents][Index]
src (module).
Next: timer-wheel/src/bt-timeout.lisp, Previous: timer-wheel/src/package.lisp, Up: Lisp [Contents][Index]
src (module).
Next: timer-wheel/src/timer-wheel.lisp, Previous: timer-wheel/src/utils.lisp, Up: Lisp [Contents][Index]
src (module).
Previous: timer-wheel/src/bt-timeout.lisp, Up: Lisp [Contents][Index]
src (module).
Next: Definitions, Previous: Files, Up: The timer-wheel Reference Manual [Contents][Index]
Packages are listed by definition order.
tw
common-lisp.
Next: Indexes, Previous: Packages, Up: The timer-wheel Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Macros, Previous: Public Interface, Up: Public Interface [Contents][Index]
milliseconds
slots per wheel
Next: Ordinary functions, Previous: Special variables, Up: Public Interface [Contents][Index]
Execute BODY after initializing WHEEL, then
clean up by shutting WHEEL down after leaving the scope.
Next: Generic functions, Previous: Macros, Up: Public Interface [Contents][Index]
Ensure the WHEEL is stopped, then initialize the WHEEL context, and start the WHEEL thread.
Return a timer object with CALLBACK being
a function that accepts WHEEL and TIMER arguments.
Make a timer wheel with SIZE slots, with a millisecond RESOLUTION, and BACKEND of :BT (bordeaux-threads... the only backend).
Schedule a timer with one of
:ticks - The number of resolution steps per (wheel-resolution wheel), minimum
of 1 tick.
:milliseconds - The integer number of milliseconds worth of ticks, must be
(and (plusp milliseconds)
(zerop (mod milliseconds (wheel-resolution wheel)))).
:seconds - The real value of seconds, rounded to the nearest resolution tick.
In all cases, the timeout will elapse in no more than
(* calculated-quantity-of-ticks resolution) milliseconds.
The keyword arguments are checked in this order: ticks, milliseconds, seconds for valid values.
Notify the wheel thread to terminate, then wait for it.
Next: Conditions, Previous: Ordinary functions, Up: Public Interface [Contents][Index]
Remove TIMER from the WHEEL schedule.
Next: Classes, Previous: Generic functions, Up: Public Interface [Contents][Index]
error.
:timer
This slot is read-only.
Previous: Conditions, Up: Public Interface [Contents][Index]
:context
(bordeaux-threads:make-lock)
:thread
:slots
0
timer-wheel:*default-resolution*
:resolution
This slot is read-only.
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
Next: Generic functions, Previous: Constants, Up: Internals [Contents][Index]
Utility function to get the current time in milliseconds.
Called from the wheel thread.
Return a data structure for managing ticks with BORDEAUX-THREADS
This is the main entry point of the timer WHEEL thread.
This thread maintains a continually updating real-time that it is targetting for precise sleeps. If a sleep cannot be done to reach the target time...i.e. we’ve missed the time getting to this thread, then increment the *timeout-overrun* counter, and keep going as though all was well. I cannot think of any specific failure behavior that would be generically ok.
Next: Classes, Previous: Ordinary functions, Up: Internals [Contents][Index]
automatically generated reader method
end.
automatically generated writer method
end.
automatically generated reader method
automatically generated writer method
Add TIMER to the WHEEL schedule.
Operate one tick of the wheel scedule.
automatically generated reader method
automatically generated writer method
Previous: Generic functions, Up: Internals [Contents][Index]
Previous: Definitions, Up: The timer-wheel Reference Manual [Contents][Index]
Jump to: | (
C F G I M R S T U W |
---|
Jump to: | (
C F G I M R S T U W |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
+
C E I R S T |
---|
Jump to: | *
+
C E I R S T |
---|
Jump to: | B C F M P S T U W |
---|
Jump to: | B C F M P S T U W |
---|