Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
seems no one discuss SetProcessAffinityMask(), can I put thread to different cpu core in Windows?
I must write an efficient program to control a machine through servo-motors on Windows 7 @ i5 processor.
I think move different thread to different CPU core will work better.
as we know , SetProcessAffinityMask() can move thread to a core, so , in QT how can i do that?
will QTConcurrent satisfy me?
You think or your know?
Do you have concrete issues or is this an attempt of premature optimisation?
How do you control these motors ?
And no, i dont think QTConcurrent will make you happy.
thanks for replying , I have some PCI control card, the card will send pulse to controller.
Windows will only run my program except himself process.
So I would like to control Intel CPU like ARM cortex series, I would like to occupy all cpu core to assure my program to run at highest priority.
@QtTester So is it currently not the case? What's your problem why you need to do such low level things instead trusting the OS doing the right thing? Do you actually have any problems?
You need to consider the architecture before writing the code.
Core1: Gui thread
Core2: Control thread1
Core3: Control thread2
Core4: Control thread3
@QtTester Why do you think you need to control which thread is running on which core?
And you did not say whether you have any real issues.
"You need to consider the architecture before writing the code" - why do you have to consider which thread is running on which core? Why don't you let the OS do it's job? What is the issue?
@jsulm OK， We can talk about in another way:
we know Windows is not a real-time OS, so ，how to make it real-time?
Windows is not a real-time OS, so ，how to make it real-time?
You ask a question and answer it by yourself in the sentence before...
Why do you need real-time? What is 'real-time' in your use-case?
We can talk about in another way
We should first talk about what you really need and whether you have any REAL issues (you refuse to answer this question). I have the impression that you're trying to solve a non-existent issue...