It turns out that the code related to the system headers thread management is really strange. For some strange reason new threads are created but not started immediately. They are only started after the normal parsing stage is done. But I don't understand why! Can someone explain why the code is written in this manner?
The name "system header thread" is quite bad, and I suggest a better name like: "header file crawler".
This part of code is independent of the normal parsing code. It just does what a file crawler does, that is collecting header files under user defined include search paths or compiler predefined include search paths.
The code is contributed by our developer Loaden(he is not active right now) several years ago. The reason those threads are started only AFTER the normal parsing stage done is that we don't want to cost CPU to much when we are in normal parsing stage. Since normal parsing stage are running thread tasks from a thread pool, thus, Loaden just deferred the header file crawler until the normal parsing stage is done.
Hope that helps.