本文整理汇总了Python中handler.Handler.fetch_to_send方法的典型用法代码示例。如果您正苦于以下问题:Python Handler.fetch_to_send方法的具体用法?Python Handler.fetch_to_send怎么用?Python Handler.fetch_to_send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类handler.Handler
的用法示例。
在下文中一共展示了Handler.fetch_to_send方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Receiver
# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import fetch_to_send [as 别名]
receiver = Receiver()
transmitter = Transmitter()
receiver.connect()
td1 = threading.Thread(target=handler.run)
td2 = threading.Thread(target=receiver.run)
td3 = threading.Thread(target=transmitter.run)
td1.start()
td2.start()
td3.start()
# main loop
while True:
if handler.is_runing() and receiver.is_runing() and transmitter.is_runing():
msg = receiver.fetch()
while msg != None:
handler.push(msg)
msg = receiver.fetch()
msg = handler.fetch_to_send()
while msg != None:
transmitter.push(msg)
msg = handler.fetch_to_send()
else:
break
handler.stop()
receiver.stop()
transmitter.stop()
td1.join()
td2.join()
td3.join()