Search code examples
multithreadingqtpthreads

QThreads Vs Pthreads


I have a quick question. I am supposed to create a small multithreaded program to grab data from multiple sensors and I have knowledge of both pthreads and qthreads. I have access to both libraries. Personally I am biased towards using Qt because of its design and various functionalities. But is there a significant advantage on using one vs the other? Thanks


Solution

  • QThreads are built upon pthreads. They provide an Object Oriented abstraction, making it easier to work with threads. Besides QThreads are portable, they can run on whatever system using the underlying thread system, while pthreads are specific of POSIX systems.

    The almost-only disadvantage of using QThreads is that you'll need to link your application against Qt; this dependence could make it a little more difficult to distribute your application.