The trivial-timer Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The trivial-timer Reference Manual

This is the trivial-timer Reference Manual, version 0.3.10, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 18:07:53 2021 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Trivial Timer Manual

[in package TRIVIAL-TIMER]

pipeline status Quicklisp coverage report

Description

Trivial Timer allows for easy scheduling of tasks (functions). The default tolerance is +- 10ms as defined by *ms-tolerance*.

Installing trivial-timer

This project is available in the latest QuickLisp distribution, so installing it is reduced to calling:

(ql:quickload :trivial-timer)

Working Example

(in-package :trivial-timer)
(initialize-timer)

(defun timer-callback (registered-time delay)
  (log:info "I was called by the timer ~a ms after registration. Expected was ~a ms."
    (- (get-internal-real-time) registered-time) delay))

(let ((delay 1000))
  (register-timer-call delay #'timer-callback))

=> I was called by the timer 992 ms after registration. Expected was 1000 ms.

Exported Symbols

License Information

This library is released under the MIT License. Please refer to the LICENSE to get the full licensing text.

Contributing to this project

Please refer to the CONTRIBUTING document for more information.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 trivial-timer

Author

Eric Diethelm <ediethelm@yahoo.com>

License

MIT

Description

Easy scheduling of tasks (functions).

Version

0.3.10

Dependencies
Source

trivial-timer.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 trivial-timer.asd

Location

trivial-timer.asd

Systems

trivial-timer (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 trivial-timer/package.lisp

Parent

trivial-timer (system)

Location

package.lisp

Packages

trivial-timer


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 trivial-timer/trivial-timer.lisp

Parent

trivial-timer (system)

Location

trivial-timer.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 trivial-timer

Trivial Timer allows for easy scheduling of tasks (functions). The default tolerance is +- 10ms as defined by **ms-tolerance**.

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *ms-tolerance*

Time tolerance (default +/- 10ms)

Package

trivial-timer

Source

trivial-timer.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: cancel-timer-call ID

Cancel a timer call identified by *ID*.
Returns **T** if the call identified by *ID* was removed.

Package

trivial-timer

Source

trivial-timer.lisp (file)

Function: initialize-timer ()

Initialization of trivial-timer. This **MUST** be called before any other function from this library.

Package

trivial-timer

Source

trivial-timer.lisp (file)

Function: register-timer-call OFFSET CALL &key RECURRING

Register a function *call* to be executed in *offset* milliseconds from now. If *recurring* is **T** then *call* will be repeated every *offset* milliseconds. Returns the ID of the registration (to be used with *cancel-timer-call*).

Package

trivial-timer

Source

trivial-timer.lisp (file)

Function: register-timer-recurring-call OFFSET CALL

Register a function *call* to be (recurrently) executed every *offset* milliseconds. Returns the ID of the registration (to be used with *cancel-timer-call*).

Package

trivial-timer

Source

trivial-timer.lisp (file)

Function: shutdown-timer ()

Shutdown the timer. No further calls can be registered. Atention: Stopping is an asynchronous request, meaning that some registered call might still be executed after calling *shutdown-timer*

Package

trivial-timer

Source

trivial-timer.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *call-id*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *call-queue*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *call-queue-lock*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *ms-to-ticks*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *shutdown-requested*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *thread-pool*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *thread-pool-size*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *ticks-tolerance*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *timer-initialized*
Package

trivial-timer

Source

trivial-timer.lisp (file)

Special Variable: *timer-thread*
Package

trivial-timer

Source

trivial-timer.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: enqueue THREAD OBJ
Package

trivial-timer

Source

trivial-timer.lisp (file)

Function: make-thread-pool-thread ()
Package

trivial-timer

Source

trivial-timer.lisp (file)

Function: thread-free? THREAD
Package

trivial-timer

Source

trivial-timer.lisp (file)

Function: timer-process ()
Package

trivial-timer

Source

trivial-timer.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Generic functions

Generic Function: call-fn OBJECT
Package

trivial-timer

Methods
Method: call-fn (REGISTERED-CALL registered-call)

automatically generated reader method

Source

trivial-timer.lisp (file)

Generic Function: call-id OBJECT
Package

trivial-timer

Methods
Method: call-id (REGISTERED-CALL registered-call)

automatically generated reader method

Source

trivial-timer.lisp (file)

Generic Function: call-offset OBJECT
Package

trivial-timer

Methods
Method: call-offset (REGISTERED-CALL registered-call)

automatically generated reader method

Source

trivial-timer.lisp (file)

Generic Function: expected-call-ts OBJECT
Generic Function: (setf expected-call-ts) NEW-VALUE OBJECT
Package

trivial-timer

Methods
Method: expected-call-ts (REGISTERED-CALL registered-call)

automatically generated reader method

Source

trivial-timer.lisp (file)

Method: (setf expected-call-ts) NEW-VALUE (REGISTERED-CALL registered-call)

automatically generated writer method

Source

trivial-timer.lisp (file)

Generic Function: queue OBJECT
Generic Function: (setf queue) NEW-VALUE OBJECT
Package

trivial-timer

Methods
Method: queue (THREADPOOL-THREAD threadpool-thread)

automatically generated reader method

Source

trivial-timer.lisp (file)

Method: (setf queue) NEW-VALUE (THREADPOOL-THREAD threadpool-thread)

automatically generated writer method

Source

trivial-timer.lisp (file)

Generic Function: queue-lock OBJECT
Generic Function: (setf queue-lock) NEW-VALUE OBJECT
Package

trivial-timer

Methods
Method: queue-lock (THREADPOOL-THREAD threadpool-thread)

automatically generated reader method

Source

trivial-timer.lisp (file)

Method: (setf queue-lock) NEW-VALUE (THREADPOOL-THREAD threadpool-thread)

automatically generated writer method

Source

trivial-timer.lisp (file)

Generic Function: queue-size OBJECT
Generic Function: (setf queue-size) NEW-VALUE OBJECT
Package

trivial-timer

Methods
Method: queue-size (THREADPOOL-THREAD threadpool-thread)

automatically generated reader method

Source

trivial-timer.lisp (file)

Method: (setf queue-size) NEW-VALUE (THREADPOOL-THREAD threadpool-thread)

automatically generated writer method

Source

trivial-timer.lisp (file)

Generic Function: recurringp OBJECT
Package

trivial-timer

Methods
Method: recurringp (REGISTERED-CALL registered-call)

automatically generated reader method

Source

trivial-timer.lisp (file)

Generic Function: thread OBJECT
Generic Function: (setf thread) NEW-VALUE OBJECT
Package

trivial-timer

Methods
Method: thread (THREADPOOL-THREAD threadpool-thread)

automatically generated reader method

Source

trivial-timer.lisp (file)

Method: (setf thread) NEW-VALUE (THREADPOOL-THREAD threadpool-thread)

automatically generated writer method

Source

trivial-timer.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Classes

Class: registered-call ()
Package

trivial-timer

Source

trivial-timer.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: id
Type

fixnum

Initargs

:id

Readers

call-id (generic function)

Slot: expected-call-ts
Type

(unsigned-byte 62)

Initargs

:expected-call-ts

Readers

expected-call-ts (generic function)

Writers

(setf expected-call-ts) (generic function)

Slot: offset
Type

(unsigned-byte 62)

Initargs

:offset

Readers

call-offset (generic function)

Slot: call-fn
Type

function

Initargs

:call-fn

Readers

call-fn (generic function)

Slot: recurring
Type

boolean

Initargs

:recurring

Readers

recurringp (generic function)

Class: threadpool-thread ()
Package

trivial-timer

Source

trivial-timer.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: queue-size
Type

fixnum

Initargs

:queue-size

Readers

queue-size (generic function)

Writers

(setf queue-size) (generic function)

Slot: thread
Type

bordeaux-threads:thread

Initargs

:thread

Readers

thread (generic function)

Writers

(setf thread) (generic function)

Slot: queue
Type

chanl:bounded-channel

Initargs

:queue

Readers

queue (generic function)

Writers

(setf queue) (generic function)

Slot: queue-lock
Type

bordeaux-threads:lock

Initargs

:queue-lock

Readers

queue-lock (generic function)

Writers

(setf queue-lock) (generic function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, trivial-timer.asd: The trivial-timer․asd file
File, Lisp, trivial-timer/package.lisp: The trivial-timer/package․lisp file
File, Lisp, trivial-timer/trivial-timer.lisp: The trivial-timer/trivial-timer․lisp file

L
Lisp File, trivial-timer.asd: The trivial-timer․asd file
Lisp File, trivial-timer/package.lisp: The trivial-timer/package․lisp file
Lisp File, trivial-timer/trivial-timer.lisp: The trivial-timer/trivial-timer․lisp file

T
trivial-timer.asd: The trivial-timer․asd file
trivial-timer/package.lisp: The trivial-timer/package․lisp file
trivial-timer/trivial-timer.lisp: The trivial-timer/trivial-timer․lisp file

Jump to:   F   L   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
C   E   F   G   I   M   Q   R   S   T  
Index Entry  Section

(
(setf expected-call-ts): Internal generic functions
(setf expected-call-ts): Internal generic functions
(setf queue): Internal generic functions
(setf queue): Internal generic functions
(setf queue-lock): Internal generic functions
(setf queue-lock): Internal generic functions
(setf queue-size): Internal generic functions
(setf queue-size): Internal generic functions
(setf thread): Internal generic functions
(setf thread): Internal generic functions

C
call-fn: Internal generic functions
call-fn: Internal generic functions
call-id: Internal generic functions
call-id: Internal generic functions
call-offset: Internal generic functions
call-offset: Internal generic functions
cancel-timer-call: Exported functions

E
enqueue: Internal functions
expected-call-ts: Internal generic functions
expected-call-ts: Internal generic functions

F
Function, cancel-timer-call: Exported functions
Function, enqueue: Internal functions
Function, initialize-timer: Exported functions
Function, make-thread-pool-thread: Internal functions
Function, register-timer-call: Exported functions
Function, register-timer-recurring-call: Exported functions
Function, shutdown-timer: Exported functions
Function, thread-free?: Internal functions
Function, timer-process: Internal functions

G
Generic Function, (setf expected-call-ts): Internal generic functions
Generic Function, (setf queue): Internal generic functions
Generic Function, (setf queue-lock): Internal generic functions
Generic Function, (setf queue-size): Internal generic functions
Generic Function, (setf thread): Internal generic functions
Generic Function, call-fn: Internal generic functions
Generic Function, call-id: Internal generic functions
Generic Function, call-offset: Internal generic functions
Generic Function, expected-call-ts: Internal generic functions
Generic Function, queue: Internal generic functions
Generic Function, queue-lock: Internal generic functions
Generic Function, queue-size: Internal generic functions
Generic Function, recurringp: Internal generic functions
Generic Function, thread: Internal generic functions

I
initialize-timer: Exported functions

M
make-thread-pool-thread: Internal functions
Method, (setf expected-call-ts): Internal generic functions
Method, (setf queue): Internal generic functions
Method, (setf queue-lock): Internal generic functions
Method, (setf queue-size): Internal generic functions
Method, (setf thread): Internal generic functions
Method, call-fn: Internal generic functions
Method, call-id: Internal generic functions
Method, call-offset: Internal generic functions
Method, expected-call-ts: Internal generic functions
Method, queue: Internal generic functions
Method, queue-lock: Internal generic functions
Method, queue-size: Internal generic functions
Method, recurringp: Internal generic functions
Method, thread: Internal generic functions

Q
queue: Internal generic functions
queue: Internal generic functions
queue-lock: Internal generic functions
queue-lock: Internal generic functions
queue-size: Internal generic functions
queue-size: Internal generic functions

R
recurringp: Internal generic functions
recurringp: Internal generic functions
register-timer-call: Exported functions
register-timer-recurring-call: Exported functions

S
shutdown-timer: Exported functions

T
thread: Internal generic functions
thread: Internal generic functions
thread-free?: Internal functions
timer-process: Internal functions

Jump to:   (  
C   E   F   G   I   M   Q   R   S   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
C   E   I   O   Q   R   S   T  
Index Entry  Section

*
*call-id*: Internal special variables
*call-queue*: Internal special variables
*call-queue-lock*: Internal special variables
*ms-to-ticks*: Internal special variables
*ms-tolerance*: Exported special variables
*shutdown-requested*: Internal special variables
*thread-pool*: Internal special variables
*thread-pool-size*: Internal special variables
*ticks-tolerance*: Internal special variables
*timer-initialized*: Internal special variables
*timer-thread*: Internal special variables

C
call-fn: Internal classes

E
expected-call-ts: Internal classes

I
id: Internal classes

O
offset: Internal classes

Q
queue: Internal classes
queue-lock: Internal classes
queue-size: Internal classes

R
recurring: Internal classes

S
Slot, call-fn: Internal classes
Slot, expected-call-ts: Internal classes
Slot, id: Internal classes
Slot, offset: Internal classes
Slot, queue: Internal classes
Slot, queue-lock: Internal classes
Slot, queue-size: Internal classes
Slot, recurring: Internal classes
Slot, thread: Internal classes
Special Variable, *call-id*: Internal special variables
Special Variable, *call-queue*: Internal special variables
Special Variable, *call-queue-lock*: Internal special variables
Special Variable, *ms-to-ticks*: Internal special variables
Special Variable, *ms-tolerance*: Exported special variables
Special Variable, *shutdown-requested*: Internal special variables
Special Variable, *thread-pool*: Internal special variables
Special Variable, *thread-pool-size*: Internal special variables
Special Variable, *ticks-tolerance*: Internal special variables
Special Variable, *timer-initialized*: Internal special variables
Special Variable, *timer-thread*: Internal special variables

T
thread: Internal classes

Jump to:   *  
C   E   I   O   Q   R   S   T  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   R   S   T  
Index Entry  Section

C
Class, registered-call: Internal classes
Class, threadpool-thread: Internal classes

P
Package, trivial-timer: The trivial-timer package

R
registered-call: Internal classes

S
System, trivial-timer: The trivial-timer system

T
threadpool-thread: Internal classes
trivial-timer: The trivial-timer system
trivial-timer: The trivial-timer package

Jump to:   C   P   R   S   T