template class MyThread : public QThread{ QMutex m; QWaitCondition cond; T *object; MyThread() : object(NULL) {} void run() { m.lock(); object = new T(); cond.wakeOne(); m.unlock(); } T *init() { start(); m.lock(); while (!object) cond.wait(&m); m.unlock(); return object; } public: static T *create() { MyThread *thread = new MyThread; return thread->init(); } };