title: Is it possible to implement polling with QThread without subclassing it?
body: <p>I have a class, which is an abstraction of some device.</p>
  
  
  
  <pre class="lang-cpp prettyprint-override"><code>class Device  
  {  
  public:  
    ...  
    void Start();  
    void Stop();  
    void MsgLoop();
  
  signals:
    void sMsgArrived();
  }  
  </code></pre>
  
  <p>Start() and Stop() are called from GUI thread. Start() begins new thread, which runs MsgLoop(). It looks like this:  </p>
  
  <pre><code>void MsgLoop()  
  {
     forever {  
        if(SUCCESS == ReadMsg()) //synchronous, non-blocking
        {
          ProcessMsg(); //quite fast
          emit sMsgArrived(); //this signal is connected with a slot in GUI thread  
        }
     }
  }
  </code></pre>
  
  <p>When Stop() is called, program should return from MsgLoop() and stop the thread. How can I implement this with QThread without subclassing it?</p>