From cb793e9e2d33002399c84afdc30038cccdc5b012 Mon Sep 17 00:00:00 2001 From: Ali Riza KESKIN Date: Mon, 20 May 2024 14:30:41 +0000 Subject: [PATCH] fix parallel remove --- src/ccode/job.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ccode/job.c b/src/ccode/job.c index 2e4cc84..c58697e 100755 --- a/src/ccode/job.c +++ b/src/ccode/job.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -13,6 +14,7 @@ void* worker_thread(void* arg) { break; } int i; + bool e = false; /* search for job */ for (i = 0; i < j->total; ++i) { if (j->jobs[i].callback != NULL) { void (*callback)(void*, ...) = j->jobs[i].callback; @@ -20,9 +22,13 @@ void* worker_thread(void* arg) { callback((void*)j->jobs[i].ctx, (void*)j->jobs[i].args); j->finished++; j->current--; + e = true; break; } } + if(!e){ + break; + } } pthread_exit(NULL); }