summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5b35c14)
Spotted by Joona.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
// If we are here it means we are not available
assert(masterThread.state == Thread::SEARCHING);
// If we are here it means we are not available
assert(masterThread.state == Thread::SEARCHING);
+ int workersCnt = 1; // At least the master is included
// Try to allocate available threads setting state to Thread::BOOKED, this
// must be done under lock protection to avoid concurrent allocation of
// the same slave by another master.
lock_grab(&threadsLock);
// Try to allocate available threads setting state to Thread::BOOKED, this
// must be done under lock protection to avoid concurrent allocation of
// the same slave by another master.
lock_grab(&threadsLock);
- for (i = 0; !Fake && i < activeThreads && booked < maxThreadsPerSplitPoint; i++)
+ for (i = 0; !Fake && i < activeThreads && workersCnt < maxThreadsPerSplitPoint; i++)
if (i != master && threads[i].is_available_to(master))
{
threads[i].state = Thread::BOOKED;
threads[i].splitPoint = &splitPoint;
splitPoint.is_slave[i] = true;
if (i != master && threads[i].is_available_to(master))
{
threads[i].state = Thread::BOOKED;
threads[i].splitPoint = &splitPoint;
splitPoint.is_slave[i] = true;
}
lock_release(&threadsLock);
// We failed to allocate even one slave, return
}
lock_release(&threadsLock);
// We failed to allocate even one slave, return
+ if (!Fake && workersCnt == 1)
return bestValue;
masterThread.activeSplitPoints++;
return bestValue;
masterThread.activeSplitPoints++;