I am using std::threads and in my setup my other threads (variable amount, currently set to 10) are using so much capacity that my used cpu in task manager goes up to 100% for the application. That makes my main thread laggy, which should be real time (I assume that this is the reason for the lag).
I debugged with Intel Amplifier, but there was no other clue why the main thread should lag. My secondary threads where all really busy.
Is it possible to tell a thread how much CPU it can use maximal? How can I make sure that my other threads don't affect the performance of my main thread?
Thread initialisation:
for (int i = 0; i < numberOfThreads; i++)
{
std::thread* thread = new std::thread(&MyClass::mWorker, this);
mThreads.push_back(thread);
}
My System: i5-4590 3.3GHz, 8 GB RAM, Windows 8 64 bit, Ogre3D Graphic Engine