Python threading._Condition() Examples

The following are 2 code examples for showing how to use threading._Condition(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module threading , or try the search function .

Example 1
Project: RAFCON   Author: DLR-RM   File: execution_status.py    License: Eclipse Public License 1.0 5 votes vote down vote up
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) 
Example 2
Project: biskit   Author: graik   File: TrackingJobMaster.py    License: GNU General Public License v3.0 5 votes vote down vote up
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