rima.lua: rewrite priority and lock logic
rima.lua: rima_get_ex returns time of task addition