projects
/
qmemory
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Risolti alcuni bug del thread
[qmemory]
/
testThread.cpp
diff --git
a/testThread.cpp
b/testThread.cpp
index
c6c6719
..
84915c3
100644
(file)
--- a/
testThread.cpp
+++ b/
testThread.cpp
@@
-18,15
+18,13
@@
TestThread::~TestThread()
}
void TestThread::run(){
}
void TestThread::run(){
- sleep(2);
+ sleep(1);
forever{
mutex.lock();
forever{
mutex.lock();
-
qsrand(QDateTime::currentDateTime().toTime_t());
sequenza.append(qrand()%9);
int i=0;
index=0;
qsrand(QDateTime::currentDateTime().toTime_t());
sequenza.append(qrand()%9);
int i=0;
index=0;
-
emit disableInterface();
while(i<sequenza.size())
{
emit disableInterface();
while(i<sequenza.size())
{
@@
-36,15
+34,12
@@
void TestThread::run(){
msleep(500 - (_score*2));
i++;
}
msleep(500 - (_score*2));
i++;
}
+
i=0;
emit enableInterface();
attendiInputUtente.wait(&mutex);
i=0;
emit enableInterface();
attendiInputUtente.wait(&mutex);
-
mutex.unlock();
mutex.unlock();
-
}
}
-
-
}
void TestThread::addUserInput(int inputUser){
}
void TestThread::addUserInput(int inputUser){
@@
-56,22
+51,19
@@
void TestThread::addUserInput(int inputUser){
if(index==sequenza.size()){
sleep(1);
attendiInputUtente.wakeAll();
if(index==sequenza.size()){
sleep(1);
attendiInputUtente.wakeAll();
-
}
}
else{
emit exit(_score);
}
}
else{
emit exit(_score);
- _score=0;
- sequenza.clear();
- index=0;
- attendiInputUtente.wakeAll();
}
}
void TestThread::genera()
{
}
}
void TestThread::genera()
{
-
+ sequenza.clear();
+ index=0;
+ _score=0;
+ emit score(_score);
attendiInputUtente.wakeAll();
attendiInputUtente.wakeAll();
-
}
}