def __del__(self):
     # joins all (running) event threads 
     for th in self._d_event_threads:
         th.join()
     
     del self._d_event_threads[0:]
     
     # call destructor of super-class
     CConnection.__del__(self)
 def __init__(self, parent, child=None):
     if not isinstance(parent, IValueModule):
         raise CorruptInterface("Need a ValueModule as parent!")
     
     CConnection.__init__(self, parent, child)
         
     self._d_buffer = []
     self._d_buffer_lock = threading.Lock()
     self._d_event_threads = []
 def _release(self):
     CConnection._release(self)
     if self._d_events_enabled and len(self._d_buffer)>0:
         # create a new thread that holds a weakref of self to process the 
         # left data.
         t = threading.Thread(target=CSequenceConnection._start_event_thread,
                              args=(weakref.proxy(self),))
         self._d_event_threads.append(t)
         t.start()
 def _release(self):
     """ Internal used method to reserve the connection and the destination
         module. Please do not use this method! Use the inhered method 
         release() instead. """
     CConnection._release(self);
                 
     if(len(self._d_buffer)>0 and self._d_events_enabled):
         # create a new thread that holds a weakref of self to process the left data.
         t = threading.Thread(target=CStreamConnection._start_event_thread,
                              args=(weakref.proxy(self),));
         self._d_event_threads.append(t);
         t.start();
    def __init__(self, parent, child = None):
        """ This is the constructor of the CStreamConnection class. The 
            parameter "parent" have to be a instance of a class derived from 
            the CModule class. This instance will be handled as the parent of
            the connection. The optional parameter child defines the child of 
            the connection an have to be an instance of a class implementing 
            the IDisposable interface. If no child is give the events will be 
            disabled. """

        if not isinstance(parent, IStreamModule):
            raise CorruptInterface("The parent have to be a StreamModule!")

        if child != None and not isinstance(child, IDisposable):
            raise CorruptInterface("The child have to be a IDisposable!")

        CConnection.__init__(self, parent, child)

        self._d_buffer = ""
        self._d_buffer_lock = threading.Lock()
        self._d_event_threads = []