#include <qthread.h>

class MyThread: public QThread
{
  public:
    virtual void run();
};

void MyThread::run()
{
  for( int count = 0; count < 4; count++ ) {
    sleep( 1 );
    qDebug( "Ping from %d (count %d)!",
            QThread::currentThread(), count );
  }
}

int main()
{
  MyThread a;
  MyThread b;
  MyThread c;
  a.start();
  b.start();
  c.start();
  a.wait();
  b.wait();
  c.wait();
}



syntax highlighted by Code2HTML, v. 0.9.1