Changeset 36892 in project


Ignore:
Timestamp:
11/24/18 19:03:43 (2 weeks ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [185.220.101.6]: Latest changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/simple-timer

    r36883 r36892  
    66Currently only a low level interface is provided.
    77
    8 TBD: Support srfi-120.
     8TBD: Support [[https://srfi.schemers.org/srfi-120/srfi-120.html|srfi-120]] too.
    99
    1010== Rationale
     
    2121timings.  (It is the job of this eggs timers to reduce the load on the
    2222timeout queue in chickens core and optimize for minimal overhead for
    23 timers canceled within less than a {{timeout-period}}.)
     23timers canceled within less than a {{timer-period}}.)
    2424
    2525Timeouts fire only if they are not canceled before at least a full
    2626{{timeout-period}} passed.  A {{timeout-period}} defaults to one
    27 second.  Timers are run in batches rounded to 0.001s of it's scheduled
    28 time every {{timer-period}}.
     27second.  Timers are run in batches rounded to {{timer-epsilon}} of
     28it's scheduled time every {{timer-period}}.
    2929
    3030== Requirements
     
    3434== API
    3535
    36 <procedure>(timeout-condition? x) -> boolean</procedure>
    37 
    38 Test x to be a timeout condition object.
    39 
    4036<procedure>(timer-period . new) -> PERIOD</procedure>
    4137
    4238Without argument queries the current period.  With argument chances
    4339the period at which timers are fired.
     40
     41<procedure>(timer-epsilon . new) -> PERIOD</procedure>
     42
     43Without argument queries the current epsilon.  With argument chances
     44the epsilon for grouping timers by due time.
    4445
    4546<procedure>(timer-condition? obj) -> boolean</procedure>
     
    6768{{timer-condition?}} is unconditionally queued.
    6869
    69 <procedure>(cancel-timer-task! TASK)</procedure>
     70<procedure>(cancel-timer-task! TASK) -> boolean</procedure>
    7071
    7172Cancels the TASK (must be a reference obtained from
     
    7374{{#f}}).
    7475
    75 == Eamples
     76Returns {{#f}} if the {{TASK}} was already canceled or fired.
     77
     78== Examples
    7679
    7780<enscript highlight="scheme">
     
    8992Cancelation: {{set! b #t}} is never invoked.
    9093<enscript highlight="scheme">
    91 (cancel-timer-task!
    92  (register-timer-task! 0.03 (lambda () (set! b #t))))
     94(or (cancel-timer-task!
     95      (register-timer-task! 0.03 (lambda () (set! b #t))))
     96    (error "too late to cancel timer"))
    9397</enscript>
    9498
Note: See TracChangeset for help on using the changeset viewer.