No answers yet, so I devised an experiment. Drop some tasks on each queue and also start some timers, see how they group:
Code: Select allfunction task_print(x)
print(x)
end
node.task.post(0, function() task_print('low 1') end)
node.task.post(0, function() task_print('low 2') end)
t1 = tmr.create()
t1:alarm(1, tmr.ALARM_SINGLE, function() task_print('tmr 1') end)
node.task.post(0, function() task_print('low 3') end)
node.task.post(1, function() task_print('med 1') end)
node.task.post(1, function() task_print('med 2') end)
t2 = tmr.create()
t2:alarm(1, tmr.ALARM_SINGLE, function() task_print('tmr 2') end)
node.task.post(1, function() task_print('med 3') end)
node.task.post(2, function() task_print('hig 1') end)
node.task.post(2, function() task_print('hig 2') end)
t3 = tmr.create()
t3:alarm(1, tmr.ALARM_SINGLE, function() task_print('tmr 3') end)
node.task.post(2, function() task_print('hig 3') end)
print('Setup done')
What I expected to see was the tmr 1 2 3 messages grouped with one set of task queue messages, probably the priority 1, 'med' ones. What I got was this:
Code: Select alldofile("logtmr.lua")
Setup done
> tmr 1
tmr 2
tmr 3
hig 1
hig 2
hig 3
med 1
med 2
med 3
low 1
low 2
low 3
It appears that tmr callbacks run at a higher priority even than high-priority task callbacks. This would suggest that tmr callbacks should be really,
really brief. Per the Developer FAQ, "The general recommendation is to keep medium priority tasks under 2mSec and low priority tasks under 15 mSec in duration. " There's no specific recommendation for high priority tasks, but I would assume it would be something under 2mSec. What would be the recommendation for tmr callbacks, I wonder?