diff --git a/collects/handin-server/doc.txt b/collects/handin-server/doc.txt index 0289294aa5..4debb8844d 100644 --- a/collects/handin-server/doc.txt +++ b/collects/handin-server/doc.txt @@ -673,7 +673,7 @@ by this function. See also `with-limits' below for adding resource limits, and `get-uncovered-expressions' above for enforcing test coverage. -> (with-limits sec mb thunk) +> (call-with-limits sec mb thunk) This function executes the given thunk with memory and time restrictions: if execution consumes more than `mb' megabytes or more that `sec' seconds, then the computation is aborted and an error is @@ -684,6 +684,9 @@ by this function. (Note: memory limit requires running in a 3m executable; the limit is only checked after a GC happens.) +> (with-limits sec mb body ...) + A macro version of the above. + _utils.ss_ ---------- diff --git a/collects/handin-server/sandbox.ss b/collects/handin-server/sandbox.ss index 901a829a17..059b422e1f 100644 --- a/collects/handin-server/sandbox.ss +++ b/collects/handin-server/sandbox.ss @@ -198,7 +198,7 @@ ;; Resources ---------------------------------------------------------------- - (define (with-limits sec mb thunk) + (define (call-with-limits sec mb thunk) (let ([cust (make-custodian)] [ch (make-channel)]) (when mb (custodian-limit-memory cust (* mb 1024 1024) cust)) @@ -219,4 +219,9 @@ (apply (car r) (cdr r)) (error 'with-limit "out of ~a" r))))) + (define-syntax with-limits + (syntax-rules () + [(with-limits sec mb body ...) + (call-with-limits sec mb (lambda () body ...))])) + )