本文整理汇总了Python中video.Video.setDaemon方法的典型用法代码示例。如果您正苦于以下问题:Python Video.setDaemon方法的具体用法?Python Video.setDaemon怎么用?Python Video.setDaemon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类video.Video
的用法示例。
在下文中一共展示了Video.setDaemon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import setDaemon [as 别名]
def run(self):
video = None
while True:
# Make sure our printing thread is alive and happy
if not video or not video.is_alive():
self.logger.info("Starting video thread")
video = Video(self.logger, self.videoQueue, self.queue)
video.setDaemon(True)
video.start()
try:
# Pull the message from the queue
msg = self.queue.get()
self.videoQueue.put(msg)
priority = msg[0]
line1 = msg[1]
line2 = msg[2]
alert = msg[3]
t0 = time.time()
if priority == PRIORITY_HIGH:
self.logger.info(line1 + " " + line2)
# If we should turn the light on, do it
if (alert):
if self.pi:
self.blink()
else:
time.sleep(LIGHT_RUN_TIME)
remaining_time = t0 + ALERT_DISPLAY_TIME - time.time()
if(remaining_time > 0):
time.sleep(remaining_time)
else:
time.sleep(SLIDE_TIME)
# All done!
self.queue.task_done()
self.logger.debug("Finished queue item. Queue size: %i" % self.queue.qsize())
except Exception as e:
self.logger.exception("Exception in printer: " + str(e))