Bonjour,
Je lance quatre fois le même thread en parallèle et je veux envoyer un signal depuis les thread vers le processus père.
Je ne vois pas où mettre le connect, le slot, et comment distinguer dans la déclaration les threads.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 int main(int argc, char *argv[]) { QApplication app(argc, argv); int noeuds(4); QStringList * ListeJob = new QStringList (); ListeJob << "AAA" << "BBB" << "CCC" << "DDD" << "EEE" << "FFF" << "GGG"; QStringList * ListeStdOut = new QStringList (); QStringList * ListeStdErr = new QStringList (); QList<Thread*> threadList; //QObject::connect(&pThread, SIGNAL(compilationFinished()),this(), SLOT(showProgress())); for (int i(0) ; i < noeuds ; ++i) { Thread * pThread = new Thread(ListeJob, ListeStdOut, ListeStdOut, i); pThread->start(); threadList << pThread; } while (threadList.count () > 0) { threadList[0]->wait (); delete threadList[0]; threadList.removeFirst (); } for (int i(0) ; i<ListeStdOut->size(); ++i) { std::cout << ListeStdOut->at(i).toStdString() << std::endl << std::endl; } delete ListeJob; delete ListeStdOut; delete ListeStdErr; return 0; } }
Je n'ai pas besoin d'identifier le thread émetteur.
Partager