The thread module contains the Thread class which provides the ability to create a threaded class. The Thread class manages starting the thread, and shutting it down appropriately. The subclasses Thread will can be notified when the thread starts, is shut down, or at each cycle so it can perform some process.
The Thread class provides a base class for creating threaded classes. It is essentially a wrapper for the threading.Thread class to make threaded classes easier to manage.
It provides the following functions that can be overridden by subclasses:
onStart(self) – This function is called when the Thread is started.
an exception is encountered while the Thread is cycling.
Thread cycles.
is shutdown.
Once the Thread has started it continues to run until the shutdown() function is called, or until the condition function returns False.
Subclasses can set the Period property which sets the number of seconds that the Thread will sleep at the end of each cycle. The default value is one millisecond.
This class implements the pyamp.logging.Loggable interface.
This method is called when at each cycle of the Thread and should be overridden by subclasses.
Note
This function should be overridden by concrete Threads.
The Thread encountered an exception.
Note
This function should be overridden by concrete Threads.
This method is called when the Thread is shut down and should be overridden by subclasses.
Note
This function should be overridden by concrete Threads.
This method is called when the Thread is started and should be overridden by subclasses.
Note
This function should be overridden by concrete Threads.