► |  | Web Server: HTTP Server

1 | Dispatching Server
2 | Dispatchers
3 | Launching Servers
4 | Web Servers
5 | Internal APIs
6 | Troubleshooting and Tips
| Index

▼ | 5 | Internal APIs

5.1 | Timers
5.2 | Connection Manager
5.3 | Serializable Closures
5.4 | Cache Table
5.5 | MIME Types
5.6 | Serialization Utilities
5.7 | URL Param
5.8 | GZip
5.9 | Miscellaneous Utilities

On this page:

timer-manager?
timer
start-timer-manager
start-timer
reset-timer!
increment-timer!
cancel-timer!

top ← prev up next →

#### 5.1`` Timers

(require web-server/private/timer)
| package: web-server-lib

This module provides a functionality for running procedures after a given amount of time, that may be extended.

> procedure (timer-manager? x) → boolean?
> x : any/c

Determines if x is a timer manager.

> > struct
> > (struct |  | timer (tm evt expire-seconds action)
> #:extra-constructor-name make-timer)
> tm : timer-manager?
> evt : evt?
> expire-seconds : number?
> action : (-> void)

evt is an alarm-evt that is ready at expire-seconds. action should be called when this evt is ready.

> procedure (start-timer-manager) → timer-manager?

Handles the execution and management of timers.

> procedure (start-timer tm s action) → timer?
> tm : timer-manager?
> s : number?
> action : (-> void)

Registers a timer that runs action after s seconds.

> procedure (reset-timer! t s) → void
> t : timer?
> s : number?

Changes t so that it will fire after s seconds.

> procedure (increment-timer! t s) → void
> t : timer?
> s : number?

Changes t so that it will fire after s seconds from when it does now.

> procedure (cancel-timer! t) → void
> t : timer?

Cancels the firing of t ever and frees resources used by t.
top ← prev up next →