def start(self): """ Starts the thread Args: None Returns: Nothing """ self.__referenceCounter.increment() if (self.__referenceCounter.read() == 1) : QueueProcessingThread.start(self)
def start(self): """ Starts the thread Args: None Returns: Nothing """ self.__referenceCounter.increment() if (self.__referenceCounter.read() == 1): QueueProcessingThread.start(self)
def __init__(self, queue, callbackObject): """ Initializes the thread's state Args: queue: The incoming packages queue callbackObject: The callback object that will process all the received packets. """ QueueProcessingThread.__init__(self, "Incoming data processing thread", queue) self.__callbackObject = callbackObject self.__referenceCounter = MultithreadingCounter()
def stop(self, join): """ Asks this thread to terminate. Args: join: When True, the calling thread will wait the incoming data thread to terminate. When False, the calling thread will only ask this thread to terminate. Returns: Nothing """ self.__referenceCounter.decrement() if self.__referenceCounter.read() == 0: QueueProcessingThread.stop(self) if join: self.join()
def stop(self, join): """ Asks this thread to terminate. Args: join: When True, the calling thread will wait the incoming data thread to terminate. When False, the calling thread will only ask this thread to terminate. Returns: Nothing """ self.__referenceCounter.decrement() if self.__referenceCounter.read() == 0 : QueueProcessingThread.stop(self) if join : self.join()
def __init__(self, queue): QueueProcessingThread.__init__(self, "Outgoing data processing thread", queue)
def run(self): QueueProcessingThread.run(self)