Comparison

net/server_epoll.lua @ 10490:c9cff02c0528

net.server_epoll: Remove unused function for adding timer at absolute time This won't make sense if we switch to monotonic time
author Kim Alvefur <zash@zash.se>
date Sun, 08 Dec 2019 13:40:42 +0100
parent 10486:479e96e554c8
child 10491:6f7a77aff9d5
comparison
equal deleted inserted replaced
10489:fabe50ea39f2 10490:c9cff02c0528
88 local function reschedule(t, time) 88 local function reschedule(t, time)
89 t[1] = time; 89 t[1] = time;
90 timers:reprioritize(t.id, time); 90 timers:reprioritize(t.id, time);
91 end 91 end
92 92
93 -- Add absolute timer 93 -- Add relative timer
94 local function at(time, f) 94 local function addtimer(timeout, f)
95 local time = gettime() + timeout;
95 local timer = { time, f, close = closetimer, reschedule = reschedule, id = nil }; 96 local timer = { time, f, close = closetimer, reschedule = reschedule, id = nil };
96 timer.id = timers:insert(timer, time); 97 timer.id = timers:insert(timer, time);
97 return timer; 98 return timer;
98 end
99
100 -- Add relative timer
101 local function addtimer(timeout, f)
102 return at(gettime() + timeout, f);
103 end 99 end
104 100
105 -- Run callbacks of expired timers 101 -- Run callbacks of expired timers
106 -- Return time until next timeout 102 -- Return time until next timeout
107 local function runtimers(next_delay, min_wait) 103 local function runtimers(next_delay, min_wait)
877 get_backend = function () return "epoll"; end; 873 get_backend = function () return "epoll"; end;
878 addserver = addserver; 874 addserver = addserver;
879 addclient = addclient; 875 addclient = addclient;
880 add_task = addtimer; 876 add_task = addtimer;
881 listen = listen; 877 listen = listen;
882 at = at;
883 loop = loop; 878 loop = loop;
884 closeall = closeall; 879 closeall = closeall;
885 setquitting = setquitting; 880 setquitting = setquitting;
886 wrapclient = wrapclient; 881 wrapclient = wrapclient;
887 watchfd = watchfd; 882 watchfd = watchfd;