Liking cljdoc? Tell your friends :D

klipse-clj.lang.clojure.guard

The basic idea is that the first time a klipse snippet's cljs is evaluated, we kick off a go-loop whose job is to wake up every 100ms and update watchdog-tick to say: this is the last time that i woke up!

And if (guard) gets run and notices that the watchdog hasn't been able to wake up within the last max-eval-duration milliseconds, it decides that we should kill the currently evaluating function, and does that by throwing an error.

and this doesn't kill go-loops created by users' snippet code, because those go-loops won't block the watchdog from running.

The basic idea is that the first time a klipse snippet's cljs is evaluated, we kick off a go-loop whose job is to wake up every 100ms and update *watchdog-tick* to say: this is the last time that i woke up!

And if (guard) gets run and notices that the watchdog hasn't been able to wake up within the last *max-eval-duration* milliseconds, it decides that we should kill the currently evaluating function, and does that by throwing an error.

and this doesn't kill go-loops created by users' snippet code, because those go-loops won't block the watchdog from running.
raw docstring

*watchdog-tick*cljs

each time the watchdog has a chance to run, this var is set with the current time

each time the watchdog has a chance to run, this var is set with the current time
sourceraw docstring

guardcljs

(guard max-eval-duration)
source

min-max-eval-durationcljs

source

my-emitscljs

(my-emits max-eval-duration & xs)

same as cljs.compiler/emits with insertion of a guard() call before if and recur (emitted as continue) statement.

Limitations:

  1. It doesn't prevent infinite loop in imported code e.g. (reduce + (range)
same as cljs.compiler/emits with insertion of a `guard()` call before if and recur (emitted as continue) statement.

Limitations:
1. It doesn't prevent infinite loop in imported code e.g. (reduce + (range)
sourceraw docstring

run-watchdog*cljs

(run-watchdog*)

reset the watchdog-tick to the current time once in a while

reset the *watchdog-tick* to the current time once in a while
sourceraw docstring

run-watchdog-oncecljs

source

runoncecljs

(runonce f)
source

tickcljs

(tick)
source

watchdogcljs

(watchdog)
source

watchdog-periodcljs

The number of msec for the watchdog period. This value has to be much lower than min-max-eval-duration.

The number of msec for the watchdog period.
This value has to be much lower than min-max-eval-duration.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close