, , , ( , Qt - ), , , .
, ( , - ), , , . , 20 , , , . , , - , . , -, .
Qt, , , ( Win32), QSemaphore :
class MyThread : public QThread
{
QSemaphore stopFlag;
public:
MyThread() : stopFlag( 1) {}
void requestStop()
{
stopFlag.tryAcquire();
}
void run()
{
while(counter1--)
{
if (!stopFlag.available()) return;
while(counter2--)
{
}
}
}
};