pithread, pitimer stop, stopAndWait

This commit is contained in:
Бычков Андрей
2022-11-09 17:17:21 +03:00
parent f9c1ef5ba4
commit d9eac06749
8 changed files with 25 additions and 20 deletions

View File

@@ -114,7 +114,7 @@ PIThreadPoolLoop::PIThreadPoolLoop(int thread_cnt) {
PIThreadPoolLoop::~PIThreadPoolLoop() {
for (auto * t: threads) {
t->stop(false);
t->stop();
if (!t->waitForFinish(100))
t->terminate();
delete t;
@@ -135,7 +135,7 @@ void PIThreadPoolLoop::start(int index_start, int index_count) {
while (1) {
int cc = counter.fetch_add(1);
if (cc >= end) {
t->stop(false);
t->stop();
return;
}
func(cc);