Machines read programmed codes in a linear fashion. That being said, the bottom-most instructions are read and executed only until later. At times and as much as possible we want to run processes simultaneously if our hardware is able. This is made possible with the idea of threads.
This blog only covers a summary of the module methods. See full documentation here.
import threading
Method | Args / Kwargs | Data Type | Description |
---|---|---|---|
threading.Thread() | creates a thread object | ||
target=target_name, args=arguments | function, tuple | defines the thread's operation by function target_name with arguments arguments | |
thread_object.start() | starts the thread_object | ||
threading.activeCount() | returns the number of active threads |