本文整理匯總了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