本文整理汇总了Python中vlcp.event.runnable.RoutineContainer.withCallback方法的典型用法代码示例。如果您正苦于以下问题:Python RoutineContainer.withCallback方法的具体用法?Python RoutineContainer.withCallback怎么用?Python RoutineContainer.withCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vlcp.event.runnable.RoutineContainer
的用法示例。
在下文中一共展示了RoutineContainer.withCallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ObjectDB
# 需要导入模块: from vlcp.event.runnable import RoutineContainer [as 别名]
# 或者: from vlcp.event.runnable.RoutineContainer import withCallback [as 别名]
#.........这里部分代码省略.........
for m in self.apiroutine.waitForSend(RetrieveReply(r[1], exception = exc)):
yield m
else:
if new_retrieve_keys:
new_retrieve_list.update(new_retrieve_keys)
self._updatekeys.update(used_keys)
self._updatekeys.add(k)
for save in savelist.values():
for k in save:
v = update_result.get(k)
if v is not None:
# If we retrieved a new value, we should also retrieved the references
# from this value
new_retrieve_keys.clear()
used_keys.clear()
default_walker(k, v, create_walker(k))
if new_retrieve_keys:
new_retrieve_list.update(new_retrieve_keys)
self._updatekeys.update(used_keys)
self._updatekeys.add(k)
retrieve_list.clear()
retrieveonce_list.clear()
retrieve_list.update(new_retrieve_list)
self._loopCount += 1
if self._stale:
watch_keys = set(retrieve_list)
watch_keys.difference_update(self._watchedkeys)
if watch_keys:
for m in self._notifier.add_listen(*tuple(watch_keys)):
yield m
self._watchedkeys.update(watch_keys)
break
while True:
for m in self.apiroutine.withCallback(updateloop(), onupdate, notification_matcher):
yield m
if self._loopCount >= 100 or self._stale:
break
# If some updated result is newer than the notification version, we should wait for the notification
should_wait = False
for k,v in update_result.items():
if k in self._watchedkeys:
oldv = self._update_version.get(k)
if oldv is not None and isnewer(v, oldv):
should_wait = True
break
if should_wait:
for m in self.apiroutine.waitWithTimeout(0.2, notification_matcher):
yield m
if self.apiroutine.timeout:
break
else:
onupdate(self.apiroutine.event, self.apiroutine.matcher)
else:
break
# Update result
send_events = []
self._transactno += 1
transactid = '%s%016x' % (timestamp, self._transactno)
update_objs = []
for k,v in update_result.items():
if k in self._watchedkeys:
if v is None:
oldv = self._managed_objs.get(k)
if oldv is not None:
if hasattr(oldv, 'kvdb_detach'):
oldv.kvdb_detach()