Skip to content

Commit e17a050

Browse files
committed
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).
1 parent 3de8bbd commit e17a050

File tree

5 files changed

+90
-69
lines changed

5 files changed

+90
-69
lines changed

0 commit comments

Comments
 (0)