Changeset 36906 in project


Ignore:
Timestamp:
11/24/18 21:48:52 (2 weeks ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [209.95.51.11]: Time parameter is relative.

File:
1 edited

Legend:

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

    r36895 r36906  
    1313settle upon.  (The issue: srfi120's task identifiers as returned by
    1414{{timer-schedule!}} are defined to be readable object, which adds
    15 undue overhead for cancelation.)
     15undue overhead for cancellation.)
    1616
    1717Every other egg implements it's own idea of timers, which makes for a
     
    1919to support most needs while having all timers in one place.
    2020
    21 These timers are assumed mostly timeouts or regular background jobs
     21Another issue frequently coming up with CHICKEN is the false deadlock
     22detection when signal handlers are used to unlock the situation.  The
     23common work around to load yet another thread looping for some time
     24puts load at the core's timeout queue.  Simply using this egg should
     25install one such timer once and for all.  (TBD: make sure this works
     26over forks too.  Should this cancel timeouts?)
     27
     28The timers here are assumed mostly timeouts or regular background jobs
    2229and hence rarely run.  They should not be sensitive to precise
    2330timings.  (It is the job of this eggs timers to reduce the load on the
     
    3239== Requirements
    3340
    34 Requires [[pigeon-hole]], [[llrb-tree]].
     41Requires [[llrb-tree]], [[pigeon-hole]].
     42
     43Notes:
     44
     45* Could use any other priority queue conforming to the srfi-69 API
     46  instead of llrb-tree
     47* pigeon-hole is merely for historical reasons
    3548
    3649== API
     
    5669<procedure>(register-timer-task! time job) -> TASK</procedure>
    5770
    58 Registers {{JOB}} to be run at {{TIME}}.  Returns a reference to the
    59 task.  The reference is opaque by definition - unlike srfi-120
    60 {{timer-schedule!}}'s task identifiers.  In fact it is a pair.
     71Registers {{JOB}} to be run after {{TIME}} has passed.  Returns a
     72reference to the task.  The reference is opaque by definition - unlike
     73srfi-120 {{timer-schedule!}}'s task identifiers.  In fact it is a
     74pair.
    6175
    6276The job is typically a thunk to be executed.  This thunk MUST NOT
     
    7488
    7589Cancels the TASK (must be a reference obtained from
    76 {{register-timer-task!}}).  (In fact it sets the cdr the reference to
    77 {{#f}}).
     90{{register-timer-task!}}).  (In fact it atomically sets the cdr of the
     91reference to {{#f}} and returns the old value.)
    7892
    7993Returns {{#f}} if the {{TASK}} was already canceled or fired.
     
    89103 (register-timer-task! 1 (current-thread))
    90104 (thread-sleep! 3)
    91  'timer-exceptions-should-have-occured-before)
     105 'timer-exceptions-should-have-occurred-before)
    92106=> #t
    93107</enscript>
Note: See TracChangeset for help on using the changeset viewer.