diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-02-14 00:18:47 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-03-15 10:48:12 -0700 |
| commit | 1fa1484288dc7431f73facb8c423b71670d6914e (patch) | |
| tree | 22a09907edad86dc053a5c6fe49b7c57445772ed /lib/std/Thread/Pool.zig | |
| parent | cff86cf7a17e038db44fa1f72ee5919eea6a6cae (diff) | |
| download | zig-1fa1484288dc7431f73facb8c423b71670d6914e.tar.gz zig-1fa1484288dc7431f73facb8c423b71670d6914e.zip | |
build runner: proper threaded dependency management
After sorting the step stack so that dependencies can be popped before
their dependants are popped, there is still a situation left to handle
correctly:
Example:
A depends on:
B
C
D depends on:
E
F
They will be ordered like this:
A B C D E F
If there are 6+ cores, then all of them will be evaluated at once,
incorrectly evaluating A and D before their dependencies.
Starting evaluation of F and then E is correct, but waiting until they
are done is not correct because it should start working on B and C as
well.
This commit solves the problem by computing dependants in the dependency
loop checking logic, and then having workers queue up their dependants
when they finish their own work.
Diffstat (limited to 'lib/std/Thread/Pool.zig')
0 files changed, 0 insertions, 0 deletions
