当前位置: 首页>>代码示例>>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;未经允许,请勿转载。