1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-02 17:22:27 +03:00

Merge branch 'develop-1.1' into 1.1-merge-up-2018-10-05

This commit is contained in:
Andrew Hutchings
2018-10-05 18:40:07 +01:00
22 changed files with 625 additions and 246 deletions

View File

@ -42,15 +42,22 @@ PriorityThreadPool::PriorityThreadPool(uint targetWeightPerRun, uint highThreads
uint midThreads, uint lowThreads, uint ID) :
_stop(false), weightPerRun(targetWeightPerRun), id(ID)
{
boost::thread* newThread;
for (uint32_t i = 0; i < highThreads; i++)
threads.create_thread(ThreadHelper(this, HIGH));
{
newThread = threads.create_thread(ThreadHelper(this, HIGH));
newThread->detach();
}
for (uint32_t i = 0; i < midThreads; i++)
threads.create_thread(ThreadHelper(this, MEDIUM));
{
newThread = threads.create_thread(ThreadHelper(this, MEDIUM));
newThread->detach();
}
for (uint32_t i = 0; i < lowThreads; i++)
threads.create_thread(ThreadHelper(this, LOW));
{
newThread = threads.create_thread(ThreadHelper(this, LOW));
newThread->detach();
}
cout << "started " << highThreads << " high, " << midThreads << " med, " << lowThreads
<< " low.\n";
defaultThreadCounts[HIGH] = threadCounts[HIGH] = highThreads;
@ -65,6 +72,7 @@ PriorityThreadPool::~PriorityThreadPool()
void PriorityThreadPool::addJob(const Job& job, bool useLock)
{
boost::thread* newThread;
mutex::scoped_lock lk(mutex, defer_lock_t());
if (useLock)
@ -73,19 +81,22 @@ void PriorityThreadPool::addJob(const Job& job, bool useLock)
// Create any missing threads
if (defaultThreadCounts[HIGH] != threadCounts[HIGH])
{
threads.create_thread(ThreadHelper(this, HIGH));
newThread = threads.create_thread(ThreadHelper(this, HIGH));
newThread->detach();
threadCounts[HIGH]++;
}
if (defaultThreadCounts[MEDIUM] != threadCounts[MEDIUM])
{
threads.create_thread(ThreadHelper(this, MEDIUM));
newThread = threads.create_thread(ThreadHelper(this, MEDIUM));
newThread->detach();
threadCounts[MEDIUM]++;
}
if (defaultThreadCounts[LOW] != threadCounts[LOW])
{
threads.create_thread(ThreadHelper(this, LOW));
newThread = threads.create_thread(ThreadHelper(this, LOW));
newThread->detach();
threadCounts[LOW]++;
}
@ -281,7 +292,6 @@ void PriorityThreadPool::sendErrorMsg(uint32_t id, uint32_t step, primitiveproce
void PriorityThreadPool::stop()
{
_stop = true;
threads.join_all();
}
} // namespace threadpool