Merge branch 'master' of git://factorcode.org/git/factor
commit
6fa2dc8de7
|
@ -5,11 +5,11 @@ HELP: alarm
|
||||||
{ $class-description "An alarm. Cancel passed to " { $link cancel-alarm } "." } ;
|
{ $class-description "An alarm. Cancel passed to " { $link cancel-alarm } "." } ;
|
||||||
|
|
||||||
HELP: add-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." } ;
|
{ $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
|
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 } "." } ;
|
{ $description "Creates and registers an alarm which calls the quotation once at " { $snippet "time" } { $link from-now } "." } ;
|
||||||
|
|
||||||
HELP: cancel-alarm
|
HELP: cancel-alarm
|
||||||
|
|
|
@ -16,7 +16,7 @@ SYMBOL: alarm-thread
|
||||||
alarm-thread get-global interrupt ;
|
alarm-thread get-global interrupt ;
|
||||||
|
|
||||||
: check-alarm
|
: 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
|
over timestamp? [ "Not a timestamp" throw ] unless
|
||||||
pick callable? [ "Not a quotation" throw ] unless ; inline
|
pick callable? [ "Not a quotation" throw ] unless ; inline
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ M: timestamp <=> ( ts1 ts2 -- n )
|
||||||
[ day>> neg ] keep
|
[ day>> neg ] keep
|
||||||
[ hour>> neg ] keep
|
[ hour>> neg ] keep
|
||||||
[ minute>> neg ] keep
|
[ minute>> neg ] keep
|
||||||
[ second>> neg ] keep
|
second>> neg
|
||||||
<duration> ;
|
<duration> ;
|
||||||
|
|
||||||
: from-now ( dt -- timestamp ) now swap time+ ;
|
: from-now ( dt -- timestamp ) now swap time+ ;
|
||||||
|
|
|
@ -9,7 +9,7 @@ HELP: <semaphore>
|
||||||
{ $description "Creates a counting semaphore with the specified initial count." } ;
|
{ $description "Creates a counting semaphore with the specified initial count." } ;
|
||||||
|
|
||||||
HELP: acquire-timeout
|
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." }
|
{ $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." } ;
|
{ $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." } ;
|
{ $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
|
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." } ;
|
{ $description "Calls the quotation with the semaphore held." } ;
|
||||||
|
|
||||||
HELP: with-semaphore
|
HELP: with-semaphore
|
||||||
|
|
|
@ -78,7 +78,7 @@ $nl
|
||||||
"This is used in situations where you want a spawn child process with some overridden environment variables." } ;
|
"This is used in situations where you want a spawn child process with some overridden environment variables." } ;
|
||||||
|
|
||||||
HELP: +timeout+
|
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
|
HELP: default-descriptor
|
||||||
{ $description "Association storing default values for launch descriptor keys." } ;
|
{ $description "Association storing default values for launch descriptor keys." } ;
|
||||||
|
|
|
@ -34,19 +34,17 @@ TUPLE: directory-iterator path bfs queue ;
|
||||||
drop r> r> r> 3drop f
|
drop r> r> r> 3drop f
|
||||||
] if ; inline
|
] 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 )
|
: 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 )
|
: find-all-files ( path bfs? quot -- paths )
|
||||||
prepare-find-file V{ } clone [
|
>r <directory-iterator> r>
|
||||||
[ over [ push ] [ 2drop ] if f ] curry compose
|
pusher >r iterate-directory drop r> ; inline
|
||||||
iterate-directory
|
|
||||||
drop
|
|
||||||
] keep ; inline
|
|
||||||
|
|
||||||
: recursive-directory ( path bfs? -- paths )
|
: recursive-directory ( path bfs? -- paths )
|
||||||
<directory-iterator>
|
[ ] accumulator >r each-file r> ;
|
||||||
[ dup next-file dup ] [ ] [ drop ] unfold nip ;
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ IN: io.timeouts
|
||||||
USING: help.markup help.syntax math kernel calendar ;
|
USING: help.markup help.syntax math kernel calendar ;
|
||||||
|
|
||||||
HELP: timeout
|
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." } ;
|
{ $contract "Outputs an object's timeout." } ;
|
||||||
|
|
||||||
HELP: set-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." } ;
|
{ $contract "Sets an object's timeout." } ;
|
||||||
|
|
||||||
HELP: timed-out
|
HELP: timed-out
|
||||||
|
|
|
@ -153,7 +153,7 @@ HELP: delay
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
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." }
|
{ $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 } "." } ;
|
{ $examples "See the example in the documentation for " { $link delay } "." } ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue