本文整理汇总了Python中eventlet.Queue.qsize方法的典型用法代码示例。如果您正苦于以下问题:Python Queue.qsize方法的具体用法?Python Queue.qsize怎么用?Python Queue.qsize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eventlet.Queue
的用法示例。
在下文中一共展示了Queue.qsize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GreenletsThread
# 需要导入模块: from eventlet import Queue [as 别名]
# 或者: from eventlet.Queue import qsize [as 别名]
class GreenletsThread(Thread):
"""
Main thread for the program. If running stand alone this will be running
as a greenlet instead.
"""
def __init__ (self, server_url, login_params):
self.running = True
self.agent = True
self.cmd_out_queue = []
self.cmd_in_queue = []
self.out_queue = Queue()
self.in_queue = Queue()
self.server_url = server_url
self.login_params = login_params
Thread.__init__(self)
def apply_position(self, obj_uuid, pos, rot=None):
cmd = ['pos', obj_uuid, pos, rot]
self.addCmd(cmd)
def __getattr__(self, name):
return ProxyFunction(name, self)
def apply_scale(self, obj_uuid, scale):
cmd = ['scale', obj_uuid, scale]
self.addCmd(cmd)
def run(self):
agent = AgentManager(self.in_queue,
self.out_queue)
error = agent.login(self.server_url, self.login_params)
if error:
self.out_queue.put(["error", str(error)])
self.out_queue.put(["agentquit", str(error)])
while self.out_queue.qsize():
api.sleep(0.1)
agent.logger.debug("Quitting")
self.agent = agent
self.running = False
def addCmd(self, cmd):
self.in_queue.put(cmd)
def getQueue(self):
out_queue = []
while self.out_queue.qsize():
out_queue.append(self.out_queue.get())
return out_queue