Skip to content
Snippets Groups Projects
Commit 9013584e authored by Mathieu Valois's avatar Mathieu Valois
Browse files

simplify work schedule

parent 1b008f81
Branches
No related tags found
No related merge requests found
Pipeline #6265 passed
......@@ -116,7 +116,7 @@ int Statsgen::generate_stats() {
if (is_stdin){
string line;
nbline = 0;
while(getline(cin, line)){
while(cin >> line){
td[nbline%nbThread].password_queue.push(line);
nbline++;
}
......@@ -126,13 +126,13 @@ int Statsgen::generate_stats() {
td[i].thread_id = i + 1;
configureThread(td[i]);
td[i].lineBegin = i*(nbline/nbThread) + 1;
td[i].lineEnd = (i+1)*nbline/nbThread;
if (i > 0) {
while (td[i].lineBegin <= td[i-1].lineEnd) {
td[i].lineBegin++;
if(i == 0){
td[i].lineBegin = 0;
}
else{
td[i].lineBegin = td[i-1].lineEnd + 1;
}
td[i].lineEnd = (i+1)*nbline/nbThread;
if(debug_enabled){
cerr << "[DEBUG] " << "Thread " << td[i].thread_id << " analyse : " << td[i].lineBegin << " --> " << td[i].lineEnd << endl;
......@@ -161,9 +161,6 @@ int Statsgen::generate_stats() {
cerr << "[ERROR] unable to join," << rc << endl;
exit(-1);
}
}
for(int i=0; i < nbThread; i++) {
td[i].finished = true;
mergeThread(td[i]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment