forked from markus/S_New4
fix stop
This commit is contained in:
parent
3f06640821
commit
2cafff45a1
@ -53,7 +53,7 @@ struct Settings {
|
|||||||
proxy_port = 9050,
|
proxy_port = 9050,
|
||||||
default_maxDirs = 20;
|
default_maxDirs = 20;
|
||||||
char pathSymbol = '/';
|
char pathSymbol = '/';
|
||||||
unsigned maxThreads = 2;
|
unsigned maxThreads = 4;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Wenn nex Thread noch in den Vector passt(weniger Threads als Max), dann Starte neuen mit data aus dem Vector...
|
||||||
if(nextThread < threadList.size()) {
|
if(nextThread < threadList.size()) {
|
||||||
threadList[nextThread]->setData(staffel, folge);
|
threadList[nextThread]->setData(staffel, folge);
|
||||||
if(pthread_create(&threadList[nextThread]->thread, nullptr, threadFunction, reinterpret_cast<void*>(threadList[nextThread])) != 0 ) {
|
if(pthread_create(&threadList[nextThread]->thread, nullptr, threadFunction, reinterpret_cast<void*>(threadList[nextThread])) != 0 ) {
|
||||||
@ -225,7 +226,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|||||||
return 48;
|
return 48;
|
||||||
}
|
}
|
||||||
nextThread++;
|
nextThread++;
|
||||||
} else {
|
} else { // Sonnst warte bis alle Fertig sind und restarte die Folge
|
||||||
for( auto &e : threadList) {
|
for( auto &e : threadList) {
|
||||||
pthread_join(e->thread, nullptr);
|
pthread_join(e->thread, nullptr);
|
||||||
if(e->exitState != 0) {
|
if(e->exitState != 0) {
|
||||||
@ -260,10 +261,28 @@ int ProgramManager::defaultModus(Settings *settings)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(folge == settings->stopEpisode && settings->stopSeason < 1) // stoppe wenn stopfolge gleich der folge ist und stopstaffel nicht gesetzt wurde.
|
if(folge == settings->stopEpisode && settings->stopSeason < 1) { // stoppe wenn stopfolge gleich der folge ist und stopstaffel nicht gesetzt wurde.
|
||||||
|
for( auto &e : threadList) {
|
||||||
|
pthread_join(e->thread, nullptr);
|
||||||
|
if(e->exitState != 0) {
|
||||||
|
std::cout << "Error: Thread gab error zurück." << std::endl;
|
||||||
|
return e->exitState;
|
||||||
|
}
|
||||||
|
std::cout << "NachThread: " << e->returnValue << std::endl;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
else if ( folge == settings->stopEpisode && staffel == settings->stopSeason) // stoppe wenn stopfolge = folge && stopstaffel == staffel
|
}
|
||||||
|
else if ( folge == settings->stopEpisode && staffel == settings->stopSeason) { // stoppe wenn stopfolge = folge && stopstaffel == staffel
|
||||||
|
for( auto &e : threadList) {
|
||||||
|
pthread_join(e->thread, nullptr);
|
||||||
|
if(e->exitState != 0) {
|
||||||
|
std::cout << "Error: Thread gab error zurück." << std::endl;
|
||||||
|
return e->exitState;
|
||||||
|
}
|
||||||
|
std::cout << "NachThread: " << e->returnValue << std::endl;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Setzte Startepisode zurück für nächste Staffel
|
//Setzte Startepisode zurück für nächste Staffel
|
||||||
settings->startEpisode = 1;
|
settings->startEpisode = 1;
|
||||||
@ -275,6 +294,18 @@ int ProgramManager::defaultModus(Settings *settings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for( auto &e : threadList) {
|
||||||
|
pthread_join(e->thread, nullptr);
|
||||||
|
if(e->exitState != 0) {
|
||||||
|
std::cout << "Error: Thread gab error zurück." << std::endl;
|
||||||
|
return e->exitState;
|
||||||
|
}
|
||||||
|
std::cout << "NachThread: " << e->returnValue << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::cout << " > Fertig" << std::endl;
|
std::cout << " > Fertig" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user