remove old cb macro

This commit is contained in:
Mike J Innes 2017-08-18 00:49:51 +01:00
parent bfe1f8eeee
commit 5f9d8702a4

View File

@ -1,30 +1,6 @@
using Juno: info
using .Batches: tobatch
"""
@cb for ... end t expr
Run the for loop, executing `expr` every `t` seconds.
"""
macro cb(ex, t, f)
@assert isexpr(ex, :for)
cond, body = ex.args
@esc t f cond body
:(let
t0 = time_ns()
dt = $t*1e9
@progress $(Expr(:for, cond, quote
t = time_ns()
if t - t0 > dt
t0 = t
f = () -> $f
f()
end
$body
end))
end)
end
"""
Returns a function that when invoked, will only be triggered at most once
during `timeout` seconds. Normally, the throttled function will run