當前位置: 首頁>>代碼示例>>Python>>正文


Python threading._Condition方法代碼示例

本文整理匯總了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) 
開發者ID:DLR-RM,項目名稱:RAFCON,代碼行數:10,代碼來源:execution_status.py

示例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 
開發者ID:graik,項目名稱:biskit,代碼行數:34,代碼來源:TrackingJobMaster.py


注:本文中的threading._Condition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。