Closed mcourteaux closed 2 weeks ago
@wolfpld New fix: keep a separate list of those that are to be reinserted. Process those first, such that the remaining ones again must be new and therefore found at the end of the workers thread-data vector. The new list avoids having to do an O(n²)
search to figure out which threads in the workers thread-data list are missing in threadOrder
.
For a detailed analysis of what was the bug, see #875. Closes #875. But in summary, the bug is due to the fact the sorting code assumes any difference in number of items in
m_threadOrder
andworker.GetThreadData()
is exclusively due to the elements in the end ofWorker::GetThreadData()
. On the surface, this is true, but the erasing logic to process Thread Hints breaks this assumed invariant.