Condition flags

HCONDNOWAIT
Guarantees that there can be no "waitfor" statements in the list of actions in this condition. All conditions that are flagged HCONDNOWAIT are handled in a separate thread, and thus aren't delayed in any way by the nature of the actions in other conditions.
HCONDINDEPENDENT
If this flag is set, then all actions in this condition are executed in a separate thread. This lets you insert delays into a condition, without incurring any delays in other conditions.

If a condition is flagged with both HCONDINDEPENDENT and HCONDNOWAIT, then HCONDNOWAIT takes precedence, and all actions in this condition are executed in the same thread as all other conditions that are also flagged as HCONDNOWAIT. This is because all HCONDNOWAIT conditions are guaranteed to have minimal delays already.

If a condition is flagged with neither HCONDNOWAIT nor HCONDINDEPENDENT, it is treated as an OTHER condition, implying that it will be executed in the FIFO order among all conditions that are true.

To sum up:

  1. Whenever a condition (e.g., CONDDEATH, CONDDETACH, etc.) occurs, all conditions flagged HCONDNOWAIT are executed in FIFO order in a single thread.
  2. All conditions flagged HCONDINDEPENDENT (but not HCONDNOWAIT) are executed each in a separate thread.
  3. All other conditions are executed in FIFO order in one single thread.

This limits the number of threads in all to be at most:

(number of HCONDINDEPENDENT conditions) + 2

That is, one for all the conditions flagged HCONDNOWAIT, and one for all OTHER conditions.

In addition, within a condition, all actions are also executed in FIFO order. This is true irrespective of whether the conditions are HCONDNOWAIT or HCONDINDEPENDENT.