码迷,mamicode.com
首页 > 系统相关 > 详细

运行进程

时间:2020-12-18 13:01:30      阅读:3      评论:0      收藏:0      [点我收藏+]

标签:machine   NPU   dispatch   Matter   ready   object   nbsp   mode   nat   

没学会  先存一个留着吗慢慢看

from translations import Machine
class Matter(object):
pass

model = Matter()

states = [‘New‘, ‘Ready‘, ‘Waiting‘, ‘Running‘, ‘Terminated‘]

transitions = [
{‘trigger‘: ‘Admitted‘, ‘source‘: ‘New‘, ‘dest‘: ‘Ready‘},
{‘trigger‘: ‘Dispatch‘, ‘source‘: ‘Ready‘, ‘dest‘: ‘Running‘},
{‘trigger‘: ‘Interrupt‘, ‘source‘: ‘Running‘, ‘dest‘: ‘Ready‘},
{‘trigger‘: ‘InputOutputoreventwait‘, ‘source‘: ‘Running‘, ‘dest‘: ‘Waiting‘},
{‘trigger‘: ‘InputOutputoreventcompletion‘,
‘source‘: ‘Waiting‘, ‘dest‘: ‘Ready‘},
{‘trigger‘: ‘Exit‘, ‘source‘: ‘Running‘, ‘dest‘: ‘Terminated‘}]

machine = Machine(model=model, states=states,
transitions=transitions, initial=‘New‘)

print(model.state) # New

model.Admitted()
print(model.state) # Ready

model.Dispatch()
print(model.state) # Running

model.InputOutputoreventwait()
print(model.state) # Waiting

model.InputOutputoreventcompletion()
print(model.state) # Ready

model.Dispatch()
print(model.state) # Running

model.Interrupt()
print(model.state) # Ready

model.Dispatch()
print(model.state) # Running

model.Exit()
print(model.state) # Terminated

运行进程

标签:machine   NPU   dispatch   Matter   ready   object   nbsp   mode   nat   

原文地址:https://www.cnblogs.com/1395372955jth/p/14130163.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!