How to create Thread on a Quad-core CPU?
I'm a new by to Qt. Please help me to understand this problem:
I have a hardware with Quad-core CPU and i use Qt to create an app for rendering image. When I click the button my app create a new windows then a new thread for rendering image. I click button 4 times and use htop to monitor CPU performance. I saw that only 1 core load 100% while others core <5%. I don't know why? It should be running parallel 4 threads on 4 cores and CPU on each core have to be the same value?
How do you create new thread if the button is clicked?
A new windows in your app does not mean a new thread.
@jsulm is this correct?
window = new Window();
in windows class constructor beside draw windows i alse call the thread:
thread = new RenderThread(); (I declare thread in windows.h)
in RenderThread Class contain run() function. So I think new thread will be created when i click the button.
Here is my project: https://github.com/NguyenTrongThinh/Queuedcustomtype-.git
Where do you start the thread? Creating an instance is not enough.
@jsulm I start thread in RenderThread constructor.
I would suggest to add some debug output (using qDebug() << "...";) to your code to see what really happens.
I addition you could check whether your app really starts several threads (on Windows you can use "Process Explorer" from SysInternals suite.