def boredthread(func):
"""
The same as "workthread" above, but drop the request on the
floor if the worker thread already has better things to do...
"""
# If we're already the work thread, just do it.
def workadd(*args, **kwargs):
if getattr(currentThread(), 'VQtWorkerThread', False):
return func(*args, **kwargs)
if not len(workerq):
workerq.append((func, args, kwargs))
functools.update_wrapper(workadd, func)
return workadd
评论列表
文章目录