本文整理汇总了Python中threading._Condition方法的典型用法代码示例。如果您正苦于以下问题:Python threading._Condition方法的具体用法?Python threading._Condition怎么用?Python threading._Condition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类threading
的用法示例。
在下文中一共展示了threading._Condition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_number_of_waiting_threads
# 需要导入模块: import threading [as 别名]
# 或者: from threading import _Condition [as 别名]
def get_number_of_waiting_threads(self):
"""
A getter for the number of waiting threads
:return:
"""
# accessing a private member of a super class is ugly; a complete custom Condition implementation would be a
# possible solution
return len(self._Condition__waiters)
示例2: getRst
# 需要导入模块: import threading [as 别名]
# 或者: from threading import _Condition [as 别名]
def getRst( self ):
"""
Get data necessary for a restart of the running calculation.
Locks, file handles and private data are *NOT* saved.
Override if necessary but call this method in child method.
@return: {..}, dict with 'pickleable' fields of master
@rtype: dict
"""
self.status.lock.acquire()
## collect master parameters that can be pickled
rst = {}
for k,v in self.__dict__.items():
skip = 0
for t in [ Thread, _RLock, _Condition, Status, file ]:
if isinstance( v, t ):
skip = 1
if str(k)[0] == '_':
skip = 1
if not skip:
rst[k] = copy.copy( v )
rst['status_objects'] = copy.deepcopy( self.status.objects )
rst['master_class'] = self.__class__
self.status.lock.release()
return rst