]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_lamp/commitdiff
tq bugfixes (and API change)
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Sat, 29 Jul 2017 19:32:45 +0000 (15:32 -0400)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Sun, 30 Jul 2017 07:06:22 +0000 (03:06 -0400)
- 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

index cceffe11792c9ed60d39b651dba04665b0523618..e9cb1046753cb17b8c176a2a176169b2766b8808 100644 (file)
@@ -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