A thread is a running macro or function, including all functions it calls.
A Thread is the basic unit to which the operating system allocates processor time. It executes code (sequence of commands). Each thread runs simultaneously with other threads, and can execute any code, including code currently being executed by another thread. Every process (running program) has one or more threads. To create effect of several simultaneously running programs, operating system divides processor time into time slices (approximately 20 ms). It allocates a processor time slice to each thread that need it. The currently executing thread is suspended when its time slice elapses, allowing another thread to run.
QM creates new thread for each macro or function started by the user. It also creates new thread for most menu items. When you use mac to run a macro or function, it also runs in new thead. Timer functions (tim) also run in new threads everytime. Threads also can be explicitly or implicitly created using some dll functions, e.g., multimedia functions.
Thre are two special threads: QM main thread, and thread of filter functions. Global variable constructors/destructors, toolbar hook functions, functions executed during compilation, and some other functions run in the QM main thread. Macro or other application can send message to run function in the QM main thread. All filter functions run in one separate thread.
QM does not allow to run more than one macro at a time, but allows several functions that user starts to run. Since every such function runs in its own thread, they can run simultaneously (including several instances of the same function).
All currently running threads, except special threads, are displayed in the Running Items list. To see the list, check View Active Items in the Run menu. To see threads without opening the QM window, use the tray menu.
Don't use thread variables and atend in special threads and threads created by dll functions. Functions registered with atend will not run, and thread variables will not be destroyed.
See also: EnumQmThreads