blob: e990236abd9b42ed4039623353c06c3684060393 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import("core.base.fwatcher")
import("core.base.scheduler")
function _watch(watchdir)
print("watch %s ..", watchdir)
fwatcher.add(watchdir)
while true do
local ok, event = fwatcher.wait(-1)
if ok > 0 then
print(event)
end
end
end
function _sleep()
while true do
print("sleep ..")
os.sleep(1000)
end
end
function main(watchdir)
scheduler.co_start(_watch, watchdir)
scheduler.co_start(_sleep)
end
|