util.{async,timer}: Move sleep() to reduce dependencies of util.timer

This commit is contained in:
Kim Alvefur 2018-07-08 00:37:01 +02:00
parent b58c44e43a
commit 9c48fc4726
2 changed files with 8 additions and 8 deletions

View file

@ -10,7 +10,6 @@ local indexedbheap = require "util.indexedbheap";
local log = require "util.logger".init("timer");
local server = require "net.server";
local get_time = require "util.time".now
local async = require "util.async";
local type = type;
local debug_traceback = debug.traceback;
local tostring = tostring;
@ -104,16 +103,9 @@ local function reschedule(id, delay)
return id;
end
local function sleep(s)
local wait, done = async.waiter();
add_task(s, done);
wait();
end
return {
add_task = add_task;
stop = stop;
reschedule = reschedule;
sleep = sleep;
};