diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-08-05 22:48:50 +0100 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-08-06 21:50:16 +0100 |
| commit | e17a050bc695f7d117b89adb1d258813593ca111 (patch) | |
| tree | f281876485848c783fb9e2a10616b98cda0b2e09 /src/codegen/spirv/Module.zig | |
| parent | 3de8bbd3d4e262df11a582fb52401b8077b5f352 (diff) | |
| download | zig-e17a050bc695f7d117b89adb1d258813593ca111.tar.gz zig-e17a050bc695f7d117b89adb1d258813593ca111.zip | |
link: prevent deadlock when prelink tasks fail
If an error occured which prevented a prelink task from being queued,
then `pending_prelink_tasks` would never be decremented, which could
cause deadlocks in some cases. So, instead of calculating ahead of time
the number of prelink tasks to expect, we use a simpler strategy which
is much like a wait group: we add 1 to a value when we spawn a worker,
and in the worker function, `defer` decrementing the value. The initial
value is 1, and there's a decrement after all of the workers are
spawned, so once it hits 0, prelink is done (be it with a failure or a
success).
Diffstat (limited to 'src/codegen/spirv/Module.zig')
0 files changed, 0 insertions, 0 deletions
