Friday 15 August 2014

timeout - Racket run thread for fixed amount of time -


I would like to run an expression in the estimation of the racket, hopefully (but not particularly expected) hope my code There is a hard time limit in it for a few seconds, it is an easy way to run some racket code, then hit it intensively before executing it from time to time and execute the fallback code?

Yes, an easy way to do this is using the library, for example: #long racket (Racket / engine is required) (define e (engine (Î »(_) ;; just keep imprinting each other (loop () (displayln" hi ") (sleep 1) (loop))))) ;; Run for only 2 seconds (Engine Run 2000E)

Instead of specifying a time, you can also specify the object to stop running when the thread is closed.

No comments:

Post a Comment