Load fixes

db4
Slava Pestov 2008-02-26 18:47:05 -06:00
parent fe37c87d2f
commit 4533e0e55e
8 changed files with 23 additions and 25 deletions

View File

@ -5,11 +5,11 @@ HELP: alarm
{ $class-description "An alarm. Cancel passed to " { $link cancel-alarm } "." } ;
HELP: add-alarm
{ $values { "quot" quotation } { "time" timestamp } { "frequency" "a " { $link dt } " or " { $link f } } { "alarm" alarm } }
{ $values { "quot" quotation } { "time" timestamp } { "frequency" "a " { $link duration } " or " { $link f } } { "alarm" alarm } }
{ $description "Creates and registers an alarm. If " { $snippet "frequency" } " is " { $link f } ", this will be a one-time alarm, otherwise it will fire with the given frequency. The quotation will be called from the alarm thread." } ;
HELP: later
{ $values { "quot" quotation } { "time" dt } { "alarm" alarm } }
{ $values { "quot" quotation } { "time" duration } { "alarm" alarm } }
{ $description "Creates and registers an alarm which calls the quotation once at " { $snippet "time" } { $link from-now } "." } ;
HELP: cancel-alarm

View File

@ -16,7 +16,7 @@ SYMBOL: alarm-thread
alarm-thread get-global interrupt ;
: check-alarm
dup dt? over not or [ "Not a dt" throw ] unless
dup duration? over not or [ "Not a duration" throw ] unless
over timestamp? [ "Not a timestamp" throw ] unless
pick callable? [ "Not a quotation" throw ] unless ; inline

View File

@ -255,12 +255,12 @@ M: timestamp <=> ( ts1 ts2 -- n )
: now ( -- timestamp ) gmt >local-time ;
: before ( dt -- -dt )
[ year>> neg ] keep
[ month>> neg ] keep
[ day>> neg ] keep
[ hour>> neg ] keep
[ year>> neg ] keep
[ month>> neg ] keep
[ day>> neg ] keep
[ hour>> neg ] keep
[ minute>> neg ] keep
[ second>> neg ] keep
second>> neg
<duration> ;
: from-now ( dt -- timestamp ) now swap time+ ;

View File

@ -9,7 +9,7 @@ HELP: <semaphore>
{ $description "Creates a counting semaphore with the specified initial count." } ;
HELP: acquire-timeout
{ $values { "semaphore" semaphore } { "timeout" "a " { $link dt } " or " { $link f } } { "value" object } }
{ $values { "semaphore" semaphore } { "timeout" "a " { $link duration } " or " { $link f } } { "value" object } }
{ $description "If the semaphore has a non-zero count, decrements it and returns immediately. Otherwise, if the timeout is " { $link f } ", waits indefinitely for the semaphore to be released. If the timeout is not " { $link f } ", waits a certain period of time, and if the semaphore still has not been released, throws an error." }
{ $errors "Throws an error if the timeout expires before the semaphore is released." } ;
@ -22,7 +22,7 @@ HELP: release
{ $description "Increments a semaphore's count. If the count was previously zero, any threads waiting on the semaphore are woken up." } ;
HELP: with-semaphore-timeout
{ $values { "semaphore" semaphore } { "timeout" "a " { $link dt } " or " { $link f } } { "quot" quotation } }
{ $values { "semaphore" semaphore } { "timeout" "a " { $link duration } " or " { $link f } } { "quot" quotation } }
{ $description "Calls the quotation with the semaphore held." } ;
HELP: with-semaphore

View File

@ -78,7 +78,7 @@ $nl
"This is used in situations where you want a spawn child process with some overridden environment variables." } ;
HELP: +timeout+
{ $description "Launch descriptor key. If set to a " { $link dt } ", specifies a maximum running time for the process. If the process runs longer than this time, it will be killed." } ;
{ $description "Launch descriptor key. If set to a " { $link duration } ", specifies a maximum running time for the process. If the process runs longer than this time, it will be killed." } ;
HELP: default-descriptor
{ $description "Association storing default values for launch descriptor keys." } ;

View File

@ -34,19 +34,17 @@ TUPLE: directory-iterator path bfs queue ;
drop r> r> r> 3drop f
] if ; inline
: prepare-find-file ( path bfs? quot -- iter quot' )
>r <directory-iterator> r> [ keep and ] curry ; inline
: find-file ( path bfs? quot -- path/f )
prepare-find-file iterate-directory ;
>r <directory-iterator> r>
[ keep and ] curry iterate-directory ; inline
: each-file ( path bfs? quot -- )
>r <directory-iterator> r>
[ f ] compose iterate-directory drop ; inline
: find-all-files ( path bfs? quot -- paths )
prepare-find-file V{ } clone [
[ over [ push ] [ 2drop ] if f ] curry compose
iterate-directory
drop
] keep ; inline
>r <directory-iterator> r>
pusher >r iterate-directory drop r> ; inline
: recursive-directory ( path bfs? -- paths )
<directory-iterator>
[ dup next-file dup ] [ ] [ drop ] unfold nip ;
[ ] accumulator >r each-file r> ;

View File

@ -2,11 +2,11 @@ IN: io.timeouts
USING: help.markup help.syntax math kernel calendar ;
HELP: timeout
{ $values { "obj" object } { "dt/f" "a " { $link dt } " or " { $link f } } }
{ $values { "obj" object } { "dt/f" "a " { $link duration } " or " { $link f } } }
{ $contract "Outputs an object's timeout." } ;
HELP: set-timeout
{ $values { "dt/f" "a " { $link dt } " or " { $link f } } { "obj" object } }
{ $values { "dt/f" "a " { $link duration } " or " { $link f } } { "obj" object } }
{ $contract "Sets an object's timeout." } ;
HELP: timed-out

View File

@ -153,7 +153,7 @@ HELP: delay
} ;
HELP: <delay>
{ $values { "model" model } { "timeout" dt } { "delay" delay } }
{ $values { "model" model } { "timeout" duration } { "delay" delay } }
{ $description "Creates a new instance of " { $link delay } ". The timeout must elapse from the time the underlying model last changed to when the delay model value is changed and its connections are notified." }
{ $examples "See the example in the documentation for " { $link delay } "." } ;