All pastes #824682 Raw Edit

vanRijn

public cpp v1 · immutable
#824682 ·published 2007-12-20 03:37 UTC
rendered paste body
static inline void startOpenTimer(DeviceCommThread *dev, QTimer *&t){	if ( !t)	{		t = new QTimer(dev);		QObject::connect(t, SIGNAL(timeout()), dev, SLOT(openDevice()));	}	// just a single-shot timer.  we'll know when to start it again...        t->setSingleShot(true);	t->start(1000);}class DeviceCommThread : public QThread{Q_OBJECT...};void DeviceCommThread::run(){	fDone = false;	startOpenTimer(this, fOpenTimer);	int sleepBetweenPoll = 2;	// keep the thread alive until we're supposed to be done	while (!fDone)	{		QThread::sleep(sleepBetweenPoll);	}}