We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9697006 commit 161b33fCopy full SHA for 161b33f
src/Concurrency/WorkContractGroup.cpp
@@ -25,7 +25,9 @@ namespace Concurrency {
25
// Helper function to create appropriately sized SignalTree
26
std::unique_ptr<SignalTreeBase> WorkContractGroup::createSignalTree(size_t capacity) {
27
size_t leafCount = (capacity + 63) / 64;
28
- size_t powerOf2 = roundUpToPowerOf2(leafCount);
+ // Ensure minimum of 2 leaves to avoid single-node tree bug
29
+ // where the same node serves as both root counter and leaf bitmap
30
+ size_t powerOf2 = std::max(roundUpToPowerOf2(leafCount), size_t(2));
31
32
return std::make_unique<SignalTree>(powerOf2);
33
}
0 commit comments