Threading in C++

In my threading tutorial at https://www.soldierx.com/Threading I covered how threading was handled by different languages. In particular, I stated that I was not particularly a fan of the threading implementation used by Java due to the fact that it forced the user to either use polymorphism (courtesy of the runnable interface) or to made a subclass of the Thread class. The biggest reason for this dislike is that this is more work than is necessary. Well, in some respects Qt works similarly on threading which bothers me a bit.

There are two ways to handle threading in Qt, and honestly it feels like a brilliant solution to a problem that shouldn't exist in the first place. The first one is similar to Java as it requires the QThread class to be inherited. The second one is to use a "worker" class with a series of signals and slots to handle the threading. Based on my experiences with other languages, both feel like a considerable amount of work that results in code that doesn't look as elegant as it could be so I feel the C++11 threading included within the STL to be the better solution at this point in time.

Overall, this shows that there are instances where using the basic STL can often yield a better solution than other libraries. I know that Qt has its own list class, but the STL rendition of lists is one that to me, did not necessitate a reinventing of the wheel. At the same time, there are some specialty list classes used in Qt such as QStringList, that have some capabilities that are more beneficial for the GUIs. With all of this taken into consideration, it is always important to investigate the best combination of clean code and efficiency.