fix timeout accounting in the scheduler

This commit is contained in:
Izaya 2023-11-12 23:31:56 +10:00
parent 5f56c74e6f
commit 1c647c76fe

View File

@ -41,7 +41,7 @@ end
function os.taskInfo(pid) -- number -- table -- returns info on process *pid* as a table with name and parent values function os.taskInfo(pid) -- number -- table -- returns info on process *pid* as a table with name and parent values
pid = pid or os.pid() pid = pid or os.pid()
if not tTasks[pid] then return false end if not tTasks[pid] then return false end
return {name=tTasks[pid].n,parent=tTasks[pid].P,cputime=tTasks[pid].t,iotime=tTasks[pid].T} return {name=tTasks[pid].n,parent=tTasks[pid].P,cputime=tTasks[pid].t,iotime=tTasks[pid].T,timeout=tTasks[pid].E}
end end
function os.sched() -- the actual scheduler function function os.sched() -- the actual scheduler function
os.sched = nil os.sched = nil
@ -60,7 +60,6 @@ function os.sched() -- the actual scheduler function
tTasks[k] = nil tTasks[k] = nil
end end
end end
sTimeout = nTimeout
end end
end end
function os.setenv(k,v) -- set's the current process' environment variable *k* to *v*, which is passed to children function os.setenv(k,v) -- set's the current process' environment variable *k* to *v*, which is passed to children
@ -73,9 +72,6 @@ function os.getenv(k) -- gets a process' *k* environment variable
return tTasks[cPid].e[k] return tTasks[cPid].e[k]
end end
end end
function os.getTimeout()
return tTasks[cPid].E
end
function os.setTimeout(n,pid) function os.setTimeout(n,pid)
assert(type(n) == "number" and n >= 0) assert(type(n) == "number" and n >= 0)
tTasks[pid or cPid].E = n tTasks[pid or cPid].E = n