1

I'm doing research on multithreads in python. Can you explain the differences between "thread and QThread" and "mutex and QMutex"?

tirit
  • 33
  • 2

1 Answers1

0

Threads are a POSIX-defined concept, that your operating system (OS) provides to your userspace applications.
But OS threads are a bit cumbersome to handle (their only interface being POSIX syscalls), so programming languages offer wrappers around native threads, but confusingly call them thread too. Different programming language thus have different wrappers, which are more coherent with the rest of the language ecosystem.
That's why in Python you have the threading.Thread class, which simplifies using threads. And while there is std::thread in C++, when you program with the framework Qt, you prefer to use QThread as they offer more functionalities, and integrate better with the rest of the QObjects.
But ultimitately, all of them are still doing the same thing, which is controlling OS threads, just in a slightly different way (programming language).

Lenormju
  • 4,078
  • 2
  • 8
  • 22