[Qt-interest] Running the application thread on class thatsubclasses QThread?

Stephan Rose kermos at somrek.net
Mon Apr 20 16:27:19 CEST 2009


>As the subject states, I'm having the need to run the main application on a 
>different thread class than QThread. The class subclasses QThread of course.
>
>Here's why:
>
>I'm working on a bunch of lock-free container implementations using Hazard 
>Pointers. In order for that to work though each thread needs its own local 
>storage of these pointers and therein lies the problem.
>
>The simplest way that isn't compiler-dependent to do this is to simply 
>subclass QThread, create a new thread called HazardThread or something and use 
>it instead. That way I can get access to each thread's necessary information 
>just using HazardThread::currentThread() and call it a day.
>
>However, my main application/gui thread would still be just a QThread which 
>means that I can't access the containers from that thread. That creates a bit 
>of a problem...
>
>Any ideas anyone?
>

Actually I just had an idea myself. Suppose if I just run my GUI on a separate thread then problem is solved. :)

Stephan



More information about the Qt-interest-old mailing list