Separate workers into a worker pool that has its own mutex
This MR builds on my repair tweaks MR, and has all the commits from it.
This MR separates the worker pool into its own object with its own mutex. There are plans to extend this object, however we can do that in v1.4.2.
The important thing about this MR is that it separates the worker pool lock from the renter lock, and it makes it so that buildUnfinishedChunks
does not need to be called while holding the renter lock. buildUnfinishedChunks
can take quite a while, so a conversion to managedBuildUnfinishedChunks
will substantially reduce lock contention.
Switching the worker pool to its own mutex also means that upload speeds are less significantly impacted by lock contention in the renter, and that renter speeds are less significantly impacted by lock contention from the worker pool.