From 48e6ed5e2042cfc24d8899d4a8838fd74d1814eb Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Sat, 29 Jul 2017 15:32:45 -0400 Subject: [PATCH] tq bugfixes (and API change) - not all lapsed time should be credited to the head node - needs to reset the time base (_tst) in all cases - always return the object for cancellation - defend against time going backwards (just in case) While here, rework to simplify, simplify API, and add comments --- linux-draw.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-draw.lua b/linux-draw.lua index cceffe1..e9cb104 100644 --- a/linux-draw.lua +++ b/linux-draw.lua @@ -29,10 +29,10 @@ end tq = dofile("tq/tq.lua")(nil) tq.__emu_lastcb = 0 tq.now = function() return cq.monotime() * 1000000 end -tq.arm = function(self,fn,t) +tq.arm = function(self,t,et) local cbix = tq.__emu_lastcb + 1 tq.__emu_lastcb = cbix - cqc:wrap(function() cq.poll(t/1000) ; if tq.__emu_lastcb == cbix then fn() end end) + cqc:wrap(function() cq.poll(t/1000) ; if tq.__emu_lastcb == cbix then tq:fire() end end) end -- how backwards is this!? We are using tq as faked above for tmr support -- 2.50.1