Module DescriptionThe tmr module implements a pollable interval timer. Due to the fact that the ANS standard does not define a way to fetch milliseconds, this module has a environmental dependency. Module WordsTimer structuretmr% ( - n ) Get the required space for the timer variable
Timer variable creation, initialisation and destructiontmr-init ( u tmr -- ) Initialise the timer with timeout u
tmr-create ( u "<spaces>name" -- ; -- tmr ) Create a named timer variable in the dictionary with timeout u
tmr-new ( u -- tmr ) Create a new timer variable on the heap with timeout u
tmr-free ( tmr -- ) Free the timer from the heap
Member wordstmr-timeout@ ( tmr -- u ) Get the timeout value from the timer
tmr-timer@ ( tmr -- u ) Get the running time u from the timer in ms, after last restart, expired? or wait
Timer wordstmr-start ( u tmr -- ) Start the timer with a timeout value u
tmr-restart ( tmr -- ) Restart the timer with the current timeout value
tmr-expired? ( tmr -- flag ) Check if the timer is expired, if so the timer is restarted
tmr-wait ( tmr -- ) Wait till the timer expires and restart the timer
Inspectiontmr-dump ( tmr -- ) Dump the tmr state
Generated by ofcfrth-0.10.0
|