This Source Code Form is subject to the terms of the Mozilla Public License,
v.2.0. If a copy of the MPL was not distributed with this file, You can obtain
one at http://mozilla.org/MPL/2.0/.
# Threading information flow
Main thread:
Get all the files to analyze.
Spawn worker threads.
Send to the worker thread the:
- file to analyze
- enough data to construct an analyzer collection
Collect the received analyze data from worker threads.
Wait until all files are analyzed and the last worker thread has sent back the data.
Dump the result according to the users config via CLI.
Worker thread:
Connect a clang AST visitor with an analyzer constructed from the builder the main thread sent over.
Run the analyze pass.
Send back the analyze result to the main thread.
# Design Assumptions
- No actual speed is gained if the working threads are higher than the core count.
Thus the number of workers are <= CPU count.
- The main thread that receive the data completely empty its mailbox.
This is not interleaved with spawning new workers.
This behavior will make it so that the worker threads sending data to the
main thread reach an equilibrium.
The number of worker threads are limited by the amount of data that the
main thread can receive.