本文整理汇总了Python中cocaine.services.Service.notify_after方法的典型用法代码示例。如果您正苦于以下问题:Python Service.notify_after方法的具体用法?Python Service.notify_after怎么用?Python Service.notify_after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocaine.services.Service
的用法示例。
在下文中一共展示了Service.notify_after方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import notify_after [as 别名]
def main():
chrono = Service("chrono")
try:
chan = yield chrono.notify_after(0.1)
except:
print "1; error while connect to service"
exit(1)
try:
id = yield chan.rx.get()
try:
yield chan.rx.get()
except:
print "2; error while read notify on notify_after method"
exit(1)
except:
print "2; error while read id on notify_after method"
exit(1)
chan = yield chrono.notify_every(0.1)
try:
id = yield chan.rx.get()
try:
yield chan.rx.get()
except:
print "2; error while read notify on notify_every method"
exit(1)
except:
print "2; error while read id on notify_every method"
exit(1)
try:
yield chrono.restart(id)
except:
print "2; error while restart id on notify_every method"
exit(1)
try:
chan = yield chrono.cancel(id)
yield chan.rx.get()
except:
print "2; error while close id on notify_every method"
exit(1)
print "0;Ok"