 : later ( quot duration -- alarm ) f add-alarm ;
 
 : every ( quot duration -- alarm ) dup add-alarm ;
-
-: cancel-alarm ( alarm -- )
-    entry>> [ alarms get-global heap-delete ] if-box? ;

! Copyright (C) 2005, 2008 Slava Pestov, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs boxes calendar
combinators.short-circuit fry heaps init kernel math.order
namespaces quotations threads math system ;
IN: alarms


: call-alarm ( alarm -- )
    [ entry>> box> drop ]
    [ dup interval>> [ reschedule-alarm ] [ drop ] if ]
    [
        [ quot>> ] [ ] bi
        '[ _ [ _ dup interval>> [ cancel-alarm ] [ drop ] if rethrow ] recover ]
        "Alarm execution" spawn drop
    ] tri ;

: (trigger-alarms) ( alarms n -- )
    over heap-empty? [
