Skip to content
Snippets Groups Projects
Commit 57dc6804934f authored by jfp's avatar jfp
Browse files

Start 1s timer only if necessary

parent ec5280befeef
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,15 @@
TRUTHY_STRINGS = ('yes', 'true', 'on', '1')
FALSY_STRINGS = ('no', 'false', 'off', '0')
timer_delay = starlet.bintim('0 0:00:01.00')[1]
timer_astctx = vmsast.AstContext(vmsast.M_WAKE | vmsast.M_QUEUE)
def start_timer():
global timer_delay, timer_astctx
timer_astctx.reset()
starlet.setimr(daytim=timer_delay, reqidt=timer_astctx)
class RestartWhenExitUnexpected:
pass
......@@ -637,6 +646,7 @@
def run(chan: int, chancmd: int, chancmd_r: int):
global timer_delay, timer_astctx
astparam: AstParam
with (
mbxqio.MBXQIO(channel=chan) as fterm,
......@@ -650,5 +660,4 @@
if pgm.autostart:
pgm.create_process(False)
timer_astctx = vmsast.AstContext(vmsast.M_WAKE | vmsast.M_QUEUE)
timer_astctx.param = AstParam(AstParamType.TIMER)
......@@ -654,4 +663,3 @@
timer_astctx.param = AstParam(AstParamType.TIMER)
timer_delay = starlet.bintim('0 0:00:01.00')[1]
starlet.setimr(daytim=timer_delay, reqidt=timer_astctx)
......@@ -656,5 +664,6 @@
starlet.setimr(daytim=timer_delay, reqidt=timer_astctx)
timer_in_progress = True
while True:
ret_ast_context: vmsast.AstContext
......@@ -675,8 +684,11 @@
elif astparam.ptype == AstParamType.CMD:
c_astctxt = qio_cmd(fcmd) # noqa: F841
elif astparam.ptype == AstParamType.TIMER:
timer_astctx.reset()
starlet.setimr(daytim=timer_delay, reqidt=timer_astctx)
timer_in_progress = False
if timer_queue.not_empty and not timer_in_progress:
timer_in_progress = True
start_timer()
def main():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment