Timer()不会在几毫秒内完成

时间:2017-09-26 11:10:21

标签: events julia

我需要每0.05秒调用一次函数,但Timer似乎具有最低的粒度:

Timer(function(timer)
    print("Hai!\n") # executed once a second
end, 0.05, true)

有没有办法让Timer工作毫秒?

1 个答案:

答案 0 :(得分:2)

Woops,丢失的类型声明不知怎的让我觉得第三个"重复"争论是Bool,但实际上是时间。所以true被转换为1.问题"已解决"。

正确:

Timer(function(timer)
    print("Hai!\n") # executed every 0.05 seconds now
end, 0, 0.05) # callback, delay time in seconds, repeat time in seconds
相关问题